diff options
Diffstat (limited to 'support/latexindent/documentation/sec-the-line-switch.tex')
-rw-r--r-- | support/latexindent/documentation/sec-the-line-switch.tex | 55 |
1 files changed, 33 insertions, 22 deletions
diff --git a/support/latexindent/documentation/sec-the-line-switch.tex b/support/latexindent/documentation/sec-the-line-switch.tex index 2fdab46512..6c2d097e89 100644 --- a/support/latexindent/documentation/sec-the-line-switch.tex +++ b/support/latexindent/documentation/sec-the-line-switch.tex @@ -21,7 +21,7 @@ latexindent.pl -n 3-7 myfile.tex \item single line, as in \texttt{--lines 5} \item multiple line ranges separated by commas, as in \texttt{--lines 3-5,8-10} \item negated line ranges, as in \texttt{--lines !3-5} which translates to \texttt{--lines - 1-2,6-N}, where N is the number of lines in your file. + 1-2,6-N}, where N is the number of lines in your file. \end{itemize} We demonstrate this feature, and the available variations in what follows. We will use @@ -34,7 +34,8 @@ latexindent.pl -n 3-7 myfile.tex \begin{commandshell} latexindent.pl --lines 3-7 myfile.tex -o=+-mod1 \end{commandshell} - which instructs \texttt{latexindent.pl} to only operate on lines 3 to 7; the output is given in \cref{lst:myfile-mod1}. + which instructs \texttt{latexindent.pl} to only operate on lines 3 to 7; the output is + given in \cref{lst:myfile-mod1}. \cmhlistingsfromfile[style=lineNumbersTeX]{demonstrations/myfile-mod1.tex}[tex-TCB]{\texttt{myfile-mod1.tex}}{lst:myfile-mod1} @@ -47,12 +48,13 @@ latexindent.pl --lines 7-3 myfile.tex -o=+-mod1 \end{example} \begin{example} - You can call the \texttt{lines} switch with only \emph{one number} and - in which case only that line will be operated upon. For example + You can call the \texttt{lines} switch with only \emph{one number} and in which case only + that line will be operated upon. For example \begin{commandshell} latexindent.pl --lines 5 myfile.tex -o=+-mod2 \end{commandshell} - instructs \texttt{latexindent.pl} to only operate on line 5; the output is given in \cref{lst:myfile-mod2}. + instructs \texttt{latexindent.pl} to only operate on line 5; the output is given in + \cref{lst:myfile-mod2}. \cmhlistingsfromfile[style=lineNumbersTeX]{demonstrations/myfile-mod2.tex}[tex-TCB]{\texttt{myfile-mod2.tex}}{lst:myfile-mod2} @@ -64,8 +66,9 @@ latexindent.pl --lines 5-5 myfile.tex \end{example} \begin{example} - If you specify a value outside of the line range of the file then \texttt{latexindent.pl} will ignore the - \texttt{lines} argument, detail as such in the log file, and proceed to operate on the entire file. + If you specify a value outside of the line range of the file then \texttt{latexindent.pl} + will ignore the \texttt{lines} argument, detail as such in the log file, and proceed to + operate on the entire file. For example, in the following call \begin{commandshell} @@ -86,7 +89,8 @@ latexindent.pl --lines -1-3 myfile.tex \begin{commandshell} latexindent.pl --lines 3-5,8-10 myfile.tex -o=+-mod3 \end{commandshell} - which instructs \texttt{latexindent.pl} to operate upon lines 3 to 5 and lines 8 to 10; the output is given in \cref{lst:myfile-mod3}. + which instructs \texttt{latexindent.pl} to operate upon lines 3 to 5 and lines 8 to 10; + the output is given in \cref{lst:myfile-mod3}. \cmhlistingsfromfile[style=lineNumbersTeX]{demonstrations/myfile-mod3.tex}[tex-TCB]{\texttt{myfile-mod3.tex}}{lst:myfile-mod3} @@ -97,28 +101,31 @@ latexindent.pl --lines 8-10,3-5 myfile.tex latexindent.pl --lines 10-8,3-5 myfile.tex latexindent.pl --lines 10-8,5-3 myfile.tex \end{commandshell} - as \texttt{latexindent.pl} performs a check to put the lowest line ranges first, and within each line range, it puts - the lowest number first. + as \texttt{latexindent.pl} performs a check to put the lowest line ranges first, and + within each line range, it puts the lowest number first. \end{example} \begin{example} - There's no limit to the number of line ranges that you can specify, they just need to be separated by commas. For example + There's no limit to the number of line ranges that you can specify, they just need to be + separated by commas. For example \begin{commandshell} latexindent.pl --lines 1-2,4-5,9-10,12 myfile.tex -o=+-mod4 \end{commandshell} - has four line ranges: lines 1 to 2, lines 4 to 5, lines 9 to 10 and line 12. The output is given in \cref{lst:myfile-mod4}. + has four line ranges: lines 1 to 2, lines 4 to 5, lines 9 to 10 and line 12. The output + is given in \cref{lst:myfile-mod4}. \cmhlistingsfromfile[style=lineNumbersTeX]{demonstrations/myfile-mod4.tex}[tex-TCB]{\texttt{myfile-mod4.tex}}{lst:myfile-mod4} - As previously, the ordering does not matter, and the following calls to \texttt{latexindent.pl} are all equivalent + As previously, the ordering does not matter, and the following calls to + \texttt{latexindent.pl} are all equivalent \begin{commandshell} latexindent.pl --lines 1-2,4-5,9-10,12 myfile.tex latexindent.pl --lines 2-1,4-5,9-10,12 myfile.tex latexindent.pl --lines 4-5,1-2,9-10,12 myfile.tex latexindent.pl --lines 12,4-5,1-2,9-10 myfile.tex \end{commandshell} - as \texttt{latexindent.pl} performs a check to put the lowest line ranges first, and within each line range, it puts - the lowest number first. + as \texttt{latexindent.pl} performs a check to put the lowest line ranges first, and + within each line range, it puts the lowest number first. \end{example} \begin{example} @@ -127,10 +134,11 @@ latexindent.pl --lines 12,4-5,1-2,9-10 myfile.tex \begin{commandshell} latexindent.pl --lines !5-7 myfile.tex -o=+-mod5 \end{commandshell} - which instructs \texttt{latexindent.pl} to operate upon all of the lines \emph{except} lines 5 to 7. + which instructs \texttt{latexindent.pl} to operate upon all of the lines \emph{except} + lines 5 to 7. - In other words, \texttt{latexindent.pl} \emph{will} operate on lines 1 to 4, and 8 to 12, so the following - two calls are equivalent: + In other words, \texttt{latexindent.pl} \emph{will} operate on lines 1 to 4, and 8 to 12, + so the following two calls are equivalent: \begin{commandshell} latexindent.pl --lines !5-7 myfile.tex latexindent.pl --lines 1-4,8-12 myfile.tex @@ -158,9 +166,11 @@ latexindent.pl --lines 1-4,8,11-12 myfile.tex -o=+-mod6 \begin{example} If you specify a line range with anything other than an integer, then - \texttt{latexindent.pl} will ignore the \texttt{lines} argument, and \emph{operate on the entire file}. + \texttt{latexindent.pl} will ignore the \texttt{lines} argument, and \emph{operate on the + entire file}. - Sample calls that result in the \texttt{lines} argument being ignored include the following: + Sample calls that result in the \texttt{lines} argument being ignored include the + following: \begin{commandshell} latexindent.pl --lines 1-x myfile.tex latexindent.pl --lines !y-3 myfile.tex @@ -174,8 +184,9 @@ latexindent.pl --lines !y-3 myfile.tex \cmhlistingsfromfile[style=lineNumbersTeX]{demonstrations/myfile1.tex}[tex-TCB]{\texttt{myfile1.tex}}{lst:myfile1} - We can demonstrate interaction with the \texttt{-m} switch (see \vref{sec:modifylinebreaks}); in particular, - if we use \vref{lst:mlb2}, \vref{lst:env-mlb7} and \vref{lst:env-mlb8} and run + We can demonstrate interaction with the \texttt{-m} switch (see + \vref{sec:modifylinebreaks}); in particular, if we use \vref{lst:mlb2}, + \vref{lst:env-mlb7} and \vref{lst:env-mlb8} and run \begin{widepage} \begin{commandshell} latexindent.pl --lines 6 myfile1.tex -o=+-mod1 -m -l env-mlb2,env-mlb7,env-mlb8 -o=+-mod1 |