Skip to main content
replaced http://tex.stackexchange.com/ with https://tex.stackexchange.com/
Source Link

How one may with section titled "zażółć gęślą jaźń" or "\newline is a new line in LaTeX" may easily escape them? It is ceratin that nothing there should be treated as LaTeX formatting.

There is a nice solution for normal text, described in How can I escape plain text?How can I escape plain text?

Unfortunately it fails for \section{}:

\documentclass{article} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{fvextra} \DefineVerbatimEnvironment{escape} {Verbatim} {fontfamily=\rmdefault,breaklines,breaksymbolleft={}} \begin{document} \tableofcontents \newpage \section{\begin{escape}\newline\end{escape}} \begin{escape} red fox sauté zażółć gęślą jaźń \newline is a new line in LaTeX Samp_Dist_Corr whatever whatever whatever whatever whatever whatever whatever whatever whatever whatever whatever \end{escape} \end{document} 

fails with

! Argument of \FV@BeginScanning has an extra }. <inserted text> \par l.14 \section{\begin{escape}\newline\end{escape}} 

Using \section{\escape{\newline}} is not changing neither outcome nor error message.

To avoid XY problem: I am using pdflatex to generate pdf files from plaintext.

How one may with section titled "zażółć gęślą jaźń" or "\newline is a new line in LaTeX" may easily escape them? It is ceratin that nothing there should be treated as LaTeX formatting.

There is a nice solution for normal text, described in How can I escape plain text?

Unfortunately it fails for \section{}:

\documentclass{article} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{fvextra} \DefineVerbatimEnvironment{escape} {Verbatim} {fontfamily=\rmdefault,breaklines,breaksymbolleft={}} \begin{document} \tableofcontents \newpage \section{\begin{escape}\newline\end{escape}} \begin{escape} red fox sauté zażółć gęślą jaźń \newline is a new line in LaTeX Samp_Dist_Corr whatever whatever whatever whatever whatever whatever whatever whatever whatever whatever whatever \end{escape} \end{document} 

fails with

! Argument of \FV@BeginScanning has an extra }. <inserted text> \par l.14 \section{\begin{escape}\newline\end{escape}} 

Using \section{\escape{\newline}} is not changing neither outcome nor error message.

To avoid XY problem: I am using pdflatex to generate pdf files from plaintext.

How one may with section titled "zażółć gęślą jaźń" or "\newline is a new line in LaTeX" may easily escape them? It is ceratin that nothing there should be treated as LaTeX formatting.

There is a nice solution for normal text, described in How can I escape plain text?

Unfortunately it fails for \section{}:

\documentclass{article} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{fvextra} \DefineVerbatimEnvironment{escape} {Verbatim} {fontfamily=\rmdefault,breaklines,breaksymbolleft={}} \begin{document} \tableofcontents \newpage \section{\begin{escape}\newline\end{escape}} \begin{escape} red fox sauté zażółć gęślą jaźń \newline is a new line in LaTeX Samp_Dist_Corr whatever whatever whatever whatever whatever whatever whatever whatever whatever whatever whatever \end{escape} \end{document} 

fails with

! Argument of \FV@BeginScanning has an extra }. <inserted text> \par l.14 \section{\begin{escape}\newline\end{escape}} 

Using \section{\escape{\newline}} is not changing neither outcome nor error message.

To avoid XY problem: I am using pdflatex to generate pdf files from plaintext.

Source Link

How can I escape plain text in section titles?

How one may with section titled "zażółć gęślą jaźń" or "\newline is a new line in LaTeX" may easily escape them? It is ceratin that nothing there should be treated as LaTeX formatting.

There is a nice solution for normal text, described in How can I escape plain text?

Unfortunately it fails for \section{}:

\documentclass{article} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{fvextra} \DefineVerbatimEnvironment{escape} {Verbatim} {fontfamily=\rmdefault,breaklines,breaksymbolleft={}} \begin{document} \tableofcontents \newpage \section{\begin{escape}\newline\end{escape}} \begin{escape} red fox sauté zażółć gęślą jaźń \newline is a new line in LaTeX Samp_Dist_Corr whatever whatever whatever whatever whatever whatever whatever whatever whatever whatever whatever \end{escape} \end{document} 

fails with

! Argument of \FV@BeginScanning has an extra }. <inserted text> \par l.14 \section{\begin{escape}\newline\end{escape}} 

Using \section{\escape{\newline}} is not changing neither outcome nor error message.

To avoid XY problem: I am using pdflatex to generate pdf files from plaintext.