TeX - LaTeX Asked on May 26, 2021
I am using the following environment for breaking long lines of code
documentclass{article}
usepackage{fancyvrb}
usepackage{fvextra}
begin{document}
Here is a very long command that I want properly formatted and fit within the page:
begin{Verbatim}[breaklines=true, breakanywhere=true]
curl -fLo outputfile.sh https://raw.githubusercontent.com/foobar/foobars_project_directory/master/scripts/foobars_script.sh && echo download complete!
end{Verbatim}
But I want to get rid of the return carriage symbols.
end{document}
However as you can see some carriage return symbols are being inserted. While these are a good visual indicator, I want to remove them so that the reader can, in general, copy and paste them into their machine.
This example perhaps doesnt best represent code that can be directly copied since it is a shell command that terminates with a newline but I have other code written in C and the like which are insensitive to newlines in between tokens and thus can, mostly, be copied and pasted without error (with some exceptions of course).
Any thoughts on how this could be done ?
For fancyvrb
with fvextra
the solution is the same as for minted
(see for example Use breaklines without arrows), because minted
uses fancyvrb
internally. So, the arrow symbol is controlled by the option breaksymbolleft
or the alias breaksymbol
. If you set this to the empty string then no symbol is printed, and also no indentation is added.
There is also a symbol on the right (a small hook) in case a string is broken in the middle of a word with breakanywhere
. To switch this off you can use the option breakanywheresymbolpre
.
MWE:
documentclass{article}
usepackage{fancyvrb}
usepackage{fvextra}
begin{document}
Here is a very long command that I want properly formatted and fit within the page:
begin{Verbatim}[breaklines=true, breakanywhere=true, breaksymbol=, breakanywheresymbolpre=]
curl -fLo outputfile.sh https://raw.githubusercontent.com/foobar/foobars_project_directory/master/scripts/foobars_script.sh && echo download complete!
end{Verbatim}
But I want to get rid of the return carriage symbols.
end{document}
Result:
Correct answer by Marijn on May 26, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP