I'm working with a program that converts markup to LaTeX documents; customization of the output is limited to defining commands to insert in the preamble. A certain markup construct gets converted to LaTeX of the form:
\newcommand{\foo}{
Here Be Text
}
(Note that the newline before "Here Be Text" is inserted unconditionally by the converter, even though there is no corresponding newline in the markup.)
I would like to use \foo
in the custom preamble to define a fancy header (\lhead{\textsc{\foo}}
). The problem is that, due to the newline after \newcommand{\foo}{
, the rendered document has a space inserted before "Here Be Text" in the header, so the header text is not flush with the hrule below it. The extra space goes away if a %
is manually inserted at the end of \newcommand{\foo}{
, but I would prefer not to have to do this.
My question is then: What can I insert in \lhead{\textsc{\foo}}
to cause it to expand to \lhead{\textsc{Here Be Text}}
instead of \lhead{\textsc{ Here Be Text}}
?
A minimum working example of what I'm dealing with:
\documentclass{article}
\newcommand{\foo}{
Here Be Text
}
\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{\textsc{\foo}}
\chead{}
\rhead{\thepage}
\cfoot{}
\begin{document}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.
\end{document}
I have no idea what to attempt to fix this; my best idea was:
\lhead{\expandafter\textsc{%
\foo}}
but that didn't make a difference.
{%
in your definitions? Your decision will bring more problems if such definitions are used in various other contexts.