diff options
Diffstat (limited to 'Master/texmf-dist/doc/support/latexindent/sec-how-to-use.tex')
-rw-r--r-- | Master/texmf-dist/doc/support/latexindent/sec-how-to-use.tex | 53 |
1 files changed, 35 insertions, 18 deletions
diff --git a/Master/texmf-dist/doc/support/latexindent/sec-how-to-use.tex b/Master/texmf-dist/doc/support/latexindent/sec-how-to-use.tex index 993e63662d5..81364b18cf9 100644 --- a/Master/texmf-dist/doc/support/latexindent/sec-how-to-use.tex +++ b/Master/texmf-dist/doc/support/latexindent/sec-how-to-use.tex @@ -21,12 +21,6 @@ If you plan to use \texttt{latexindent.pl} (i.e, the original Perl script) then you will need a few standard Perl modules -- see \vref{sec:requiredmodules} for details. - As you read through this documentation, you'll occasionally see dates shown in the margin - (for example, next to this paragraph!) - \announce{2017-06-25} which detail the date of the version in which the feature was implemented; - the `N' stands for `new as of the date shown'. If you see a $\color{cmhgold}\bigstar$, it - means that the feature is new as of the release of the current version. - \subsection{From the command line}\label{sec:commandline} \texttt{latexindent.pl} has a number of different switches/flags/options, which can be combined in any way that you like, either in short or long form as detailed below. @@ -45,7 +39,7 @@ latexindent.pl and available options. \flagbox{-v, --version} - \announce{2017-06-25} + \announce{2017-06-25}{version} \begin{commandshell} latexindent.pl -v \end{commandshell} @@ -103,7 +97,7 @@ latexindent.pl myfile.tex > output.tex \end{commandshell} You can call the \texttt{-o} switch with the name of the output file \emph{without} an extension; in - \announce{2017-06-25} + \announce{2017-06-25}{upgrade to -o switch} this case, \texttt{latexindent.pl} will use the extension from the original file. For example, the following two calls to \texttt{latexindent.pl} are equivalent: \begin{commandshell} @@ -112,7 +106,7 @@ latexindent.pl myfile.tex -o=output.tex \end{commandshell} You can call the \texttt{-o} switch using a \texttt{+} symbol at the beginning; this will - \announce{2017-06-25} + \announce{2017-06-25}{+ sign in o switch} concatenate the name of the input file and the text given to the \texttt{-o} switch. For example, the following two calls to \texttt{latexindent.pl} are equivalent: \begin{commandshell} @@ -121,7 +115,7 @@ latexindent.pl myfile.tex -o=myfilenew.tex \end{commandshell} You can call the \texttt{-o} switch using a \texttt{++} symbol at the end of the name - \announce{2017-06-25} + \announce{2017-06-25}{++ in o switch} of your output file; this tells \texttt{latexindent.pl} to search successively for the name of your output file concatenated with $0, 1, \ldots$ while the name of the output file exists. For example, @@ -205,12 +199,17 @@ latexindent.pl myfile.tex -l=first.yaml,second.yaml,third.yaml The \texttt{-l} flag can take an \emph{optional} parameter which details the name (or names separated by commas) of a YAML file(s) that resides in the same directory as \texttt{myfile.tex}; you can use this option if you would like to load a settings file in the current working directory that is \emph{not} called \texttt{localSettings.yaml}. - In fact, you can specify \emph{relative} path names to the current directory, but \emph{not} - absolute paths -- for absolute paths, see \vref{sec:indentconfig}. - Explicit demonstrations of how to use the \texttt{-l} switch are given throughout this documentation. + \announce*{2017-08-21}*{-l switch absolute paths} In fact, you can specify both \emph{relative} and \emph{absolute paths} for your YAML files; + for example + \begin{commandshell} +latexindent.pl -l=../../myyaml.yaml myfile.tex +latexindent.pl -l=/home/cmhughes/Desktop/myyaml.yaml myfile.tex +latexindent.pl -l=C:\Users\cmhughes\Desktop\myyaml.yaml myfile.tex + \end{commandshell} + You will find a lot of other explicit demonstrations of how to use the \texttt{-l} switch throughout this documentation, You can call the \texttt{-l} switch with a `+' symbol either before or after - \announce{2017-06-25} + \announce{2017-06-25}{+ sign with -l switch} another YAML file; for example: \begin{commandshell} latexindent.pl -l=+myyaml.yaml myfile.tex @@ -231,13 +230,29 @@ latexindent.pl -l+myyaml.yaml myfile.tex \begin{commandshell} latexindent.pl -l + myyaml.yaml myfile.tex \end{commandshell} - will \emph{only} load \texttt{localSettings.yaml}, and \texttt{myyaml.yaml} will be ignored. + will \emph{only} load \texttt{localSettings.yaml}, and \texttt{myyaml.yaml} will be ignored. If you wish + to use spaces between any of the YAML settings, then you must wrap the entire list of YAML files in quotes, as demonstrated above. You may also choose to omit the \texttt{yaml} extension, such as - \announce{2017-06-25} + \announce{2017-06-25}{no extension for -l switch} \begin{commandshell} latexindent.pl -l=localSettings,myyaml myfile.tex \end{commandshell} +\flagbox{-y, --yaml=yaml settings} + \begin{commandshell} +latexindent.pl myfile.tex -y="defaultIndent: ' '" +latexindent.pl myfile.tex -y="defaultIndent: ' ',maximumIndentation:' '" +latexindent.pl myfile.tex -y="indentRules: one: '\t\t\t\t'" +latexindent.pl myfile.tex -y='modifyLineBreaks:environments:EndStartsOnOwnLine:3' -m +latexindent.pl myfile.tex -y='modifyLineBreaks:environments:one:EndStartsOnOwnLine:3' -m + \end{commandshell} + \label{page:yamlswitch}You% + \announce*{2017-08-21}{the -y switch} can specify YAML settings from the command line using the \texttt{-y} or \texttt{--yaml} switch; + sample demonstrations are given above. Note, in particular, that multiple settings can be specified by separating them + via commas. There is a further option to use a \texttt{;} to separate fields, which is demonstrated in \vref{sec:yamlswitch}. + + Any settings specified via this switch will be loaded \emph{after} + any specified using the \texttt{-l} switch. This is discussed further in \vref{sec:loadorder}. \flagbox{-d, --onlydefault} \begin{commandshell} latexindent.pl -d myfile.tex @@ -246,10 +261,12 @@ latexindent.pl -d myfile.tex Only \texttt{defaultSettings.yaml}: you might like to read \cref{sec:defuseloc} before using this switch. By default, \texttt{latexindent.pl} will always search for \texttt{indentconfig.yaml} or \texttt{.indentconfig.yaml} in your home directory. If you would prefer it not to do so - then (instead of deleting or renaming \texttt{indentconfig.yaml}/\texttt{.indentconfig.yaml}) you can simply + then (instead of deleting or renaming \texttt{indentconfig.yaml} or \texttt{.indentconfig.yaml}) you can simply call the script with the \texttt{-d} switch; note that this will also tell the script to ignore \texttt{localSettings.yaml} even if it has been called with the - \texttt{-l} switch. + \texttt{-l} switch; \texttt{latexindent.pl}% + \announce*{2017-08-21}*{updated -d switch} will also ignore any settings specified + from the \texttt{-y} switch. \flagbox{-c, --cruft=<directory>} \begin{commandshell} |