summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/support/latexindent/sec-the-m-switch.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/support/latexindent/sec-the-m-switch.tex')
-rw-r--r--Master/texmf-dist/doc/support/latexindent/sec-the-m-switch.tex60
1 files changed, 51 insertions, 9 deletions
diff --git a/Master/texmf-dist/doc/support/latexindent/sec-the-m-switch.tex b/Master/texmf-dist/doc/support/latexindent/sec-the-m-switch.tex
index 3677af3f169..0ff58be3153 100644
--- a/Master/texmf-dist/doc/support/latexindent/sec-the-m-switch.tex
+++ b/Master/texmf-dist/doc/support/latexindent/sec-the-m-switch.tex
@@ -357,7 +357,7 @@ latexindent.pl -s textwrap6.tex -l=textwrap11.yaml -m
\subsection{oneSentencePerLine: modifying line breaks for sentences}\label{sec:onesentenceperline}
You can instruct \texttt{latexindent.pl} to
- format%%%%%
+ format%%%%%%
\announce{2018-01-13}{one sentence per line} your file so that
it puts one sentence per line. Thank you to \cite{mlep} for helping to
shape and test this feature. The behaviour of this part of the script is controlled by
@@ -650,7 +650,7 @@ latexindent.pl multiple-sentences4 -m -l=item-rules2.yaml
\end{minipage}
\subsubsection{text wrapping and indenting sentences}
- The \texttt{oneSentencePerLine}%%
+ The \texttt{oneSentencePerLine}%%%
\announce*{2018-08-13}{oneSentencePerline text wrap and indent} can be instructed to perform
text wrapping and indentation upon sentences.
@@ -679,6 +679,48 @@ latexindent.pl multiple-sentences5 -m -l=sentence-wrap1.yaml
\vref{lst:textwrap9-yaml}, for example, you would replace/append
\texttt{environments} with, for example, \texttt{sentence: 50}.
+ The indentation of sentences requires that sentences are stored as code blocks. This
+ means that you may need to tweak \vref{lst:sentencesEndWith}. Let's explore this in
+ relation to \cref{lst:multiple-sentences6}.
+
+ \cmhlistingsfromfile*{demonstrations/multiple-sentences6.tex}{\texttt{multiple-sentences6.tex}}{lst:multiple-sentences6}
+
+ By default, \texttt{latexindent.pl} will find the full-stop within the first
+ \texttt{item}, which means that, upon running the following commands
+ \begin{commandshell}
+latexindent.pl multiple-sentences6 -m -l=sentence-wrap1.yaml
+latexindent.pl multiple-sentences6 -m -l=sentence-wrap1.yaml -y="modifyLineBreaks:oneSentencePerLine:sentenceIndent:''"
+\end{commandshell}
+ we receive the respective output in \cref{lst:multiple-sentences6-mod1} and
+ \cref{lst:multiple-sentences6-mod2}.
+
+ \cmhlistingsfromfile*{demonstrations/multiple-sentences6-mod1.tex}{\texttt{multiple-sentences6-mod1.tex} using \cref{lst:sentence-wrap1-yaml}}{lst:multiple-sentences6-mod1}
+
+ \cmhlistingsfromfile*{demonstrations/multiple-sentences6-mod2.tex}{\texttt{multiple-sentences6-mod2.tex} using \cref{lst:sentence-wrap1-yaml} and no sentence indentation}{lst:multiple-sentences6-mod2}
+
+ We note that \cref{lst:multiple-sentences6-mod1} the \texttt{itemize} code block has
+ \emph{not} been indented appropriately. This is because the
+ oneSentencePerLine has been instructed to store sentences (because
+ \cref{lst:sentence-wrap1-yaml}); each sentence is then searched for code blocks.
+
+ We can tweak the settings in \vref{lst:sentencesEndWith} to ensure that full stops are
+ not followed by \texttt{item} commands, and that the end of sentences
+ contains \lstinline!\end{itemize}! as in \cref{lst:itemize-yaml} (if you intend to use this, ensure that you
+ remove the line breaks from the \texttt{other} field).
+
+ \cmhlistingsfromfile*[style=yaml-LST]*{demonstrations/itemized.yaml}[MLB-TCB]{\texttt{itemize.yaml}}{lst:itemize-yaml}
+
+ Upon running
+ \begin{commandshell}
+latexindent.pl multiple-sentences6 -m -l=sentence-wrap1.yaml,itemize.yaml
+\end{commandshell}
+ we receive the output in \cref{lst:multiple-sentences6-mod3}.
+
+ \cmhlistingsfromfile*{demonstrations/multiple-sentences6-mod3.tex}{\texttt{multiple-sentences6-mod3.tex} using \cref{lst:sentence-wrap1-yaml} and \cref{lst:itemize-yaml}}{lst:multiple-sentences6-mod3}
+
+ Notice that the sentence has received indentation, and that the
+ \texttt{itemize} code block has been found and indented correctly.
+
\subsection{removeParagraphLineBreaks: modifying line breaks for paragraphs}\label{subsec:removeparagraphlinebreaks}
When the \texttt{-m} switch is active \texttt{latexindent.pl} has the
ability to remove line breaks%
@@ -821,7 +863,7 @@ latexindent.pl -m shortlines-md.tex -o shortlines-md4.tex -l remove-para4.yaml
\end{widepage}
then we obtain the output in \cref{lst:shortlines-md4}. \cmhlistingsfromfile{demonstrations/shortlines-md4.tex}{\texttt{shortlines-md4.tex}}{lst:shortlines-md4}
- Note%%%%
+ Note%%%%%
\announce*{2018-08-13}*{updates to all in removeParagraphLineBreaks} that the
\texttt{all} field can take the same exceptions detailed in
\cref{lst:textwrap6-yaml}{lst:textwrap8-yaml}.
@@ -889,7 +931,7 @@ latexindent.pl -m sl-stop.tex -o sl-stop4-comment.tex -l=remove-para4.yaml,stop-
\subsection{Combining removeParagraphLineBreaks and textWrapOptions}\label{subsec:removeparagraphlinebreaks:and:textwrap}
- The%%%%
+ The%%%%%
\announce*{2018-08-13}{combine text wrap and remove paragraph line breaks} text wrapping
routine (\vref{subsec:textwrapping}) and remove paragraph line breaks routine
(\vref{subsec:removeparagraphlinebreaks}) can be combined.
@@ -929,7 +971,7 @@ latexindent.pl -m textwrap7.tex -l=textwrap12.yaml -o=+-mod12
\subsection{Poly-switches}\label{sec:poly-switches}
Every other field in the \texttt{modifyLineBreaks} field uses poly-switches, and can
- take one of \emph{five}%%%%%
+ take one of \emph{five}%%%%%%
\announce{2017-08-21}*{blank line poly-switch} integer values:
\begin{itemize}[font=\bfseries]
\item[$-1$] \emph{remove mode}: line breaks before or after the
@@ -1044,7 +1086,7 @@ latexindent.pl -m env-mlb.tex -l env-mlb2.yaml
comment symbol has been added before adding the line break; in both cases, trailing
horizontal space has been stripped before doing so.
- Let's%%%%%
+ Let's%%%%%%
\announce{2017-08-21}{demonstration of blank line poly-switch (3)} now change each
of the \texttt{1} values in \cref{lst:env-mlb1,lst:env-mlb2} so that they are
$3$ and save them into \texttt{env-mlb5.yaml} and
@@ -1142,7 +1184,7 @@ latexindent.pl -m env-mlb.tex -l env-mlb8.yaml
comment symbol has been added before adding the line break; in both cases, trailing
horizontal space has been stripped before doing so.
- Let's%%%%%
+ Let's%%%%%%
\announce{2017-08-21}{demonstration of blank line poly-switch (3)} now change each of
the \texttt{1} values in \cref{lst:env-mlb7,lst:env-mlb8} so that they are
$3$ and save them into \texttt{env-mlb11.yaml} and
@@ -1425,7 +1467,7 @@ latexindent.pl -m env-mlb7.tex -l env-mlb13.yaml,env-mlb14.yaml,UnpreserveBlankL
ifelsefi & \verb!before words!$\BeginStartsOnOwnLine$ & $\BeginStartsOnOwnLine$ & IfStartsOnOwnLine \\
& \verb!\if...!$\BodyStartsOnOwnLine$ & $\BodyStartsOnOwnLine$ & BodyStartsOnOwnLine \\
& \verb!body of if/or statement!$\OrStartsOnOwnLine$ & $\OrStartsOnOwnLine$ & OrStartsOnOwnLine %
- \announce{2018-04-27}{new ifElseFi code block polyswitches} \\
+ \announce{2018-04-27}{new ifElseFi code block polyswitches} \\
& \verb!\or!$\OrFinishesWithLineBreak$ & $\OrFinishesWithLineBreak$ & OrFinishesWithLineBreak \\
& \verb!body of if/or statement!$\ElseStartsOnOwnLine$ & $\ElseStartsOnOwnLine$ & ElseStartsOnOwnLine \\
& \verb!\else!$\ElseFinishesWithLineBreak$ & $\ElseFinishesWithLineBreak$ & ElseFinishesWithLineBreak \\
@@ -1464,7 +1506,7 @@ latexindent.pl -m env-mlb7.tex -l env-mlb13.yaml,env-mlb14.yaml,UnpreserveBlankL
specialBeginEnd & before words$\BeginStartsOnOwnLine$ & $\BeginStartsOnOwnLine$ & SpecialBeginStartsOnOwnLine \\
& \verb!\[!$\BodyStartsOnOwnLine$ & $\BodyStartsOnOwnLine$ & SpecialBodyStartsOnOwnLine \\
& \verb!body of special/middle!$\ElseStartsOnOwnLine$ & $\ElseStartsOnOwnLine$ & SpecialMiddleStartsOnOwnLine %
- \announce{2018-04-27}{new special code block polyswitches} \\
+ \announce{2018-04-27}{new special code block polyswitches} \\
& \verb!\middle!$\ElseFinishesWithLineBreak$ & $\ElseFinishesWithLineBreak$ & SpecialMiddleFinishesWithLineBreak \\
& body of special/middle $\EndStartsOnOwnLine$ & $\EndStartsOnOwnLine$ & SpecialEndStartsOnOwnLine \\
& \verb!\]!$\EndFinishesWithLineBreak$ & $\EndFinishesWithLineBreak$ & SpecialEndFinishesWithLineBreak \\