Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Multiline string eats LaTeX tags due to backslash

To create a multipage LaTeX document where each page is exactly the same except with a different name at the top, I want something like the following:

common_beginning = '{\bf To: '
list_of_names = ['Anna', 'Bev', 'Carlee']
common_end = """}

\footnotesize
This is small text.
\normalsize
Here is some more.
\newpage
"""

The issue is that when I compile the strings, I get:

common_beginning
'{\x08f To:'

common_end
'}\n\n\x0cootnotesize\nThis is small text.\n\normalsize\nHere is some more.\n\newpage\n'

In this example, it is eating the \b and the \f at the beginning of the LaTeX tags "\bf" and "\footnotesize". In my actual document, it eats the \n from "\newpage" and the \t from "\textwidth" as well. In any case, the backslashes really seem to mess things up. Is there a way around this?

click to hide/show revision 2
retagged

Multiline string eats LaTeX tags due to backslash

To create a multipage LaTeX document where each page is exactly the same except with a different name at the top, I want something like the following:

common_beginning = '{\bf To: '
list_of_names = ['Anna', 'Bev', 'Carlee']
common_end = """}

\footnotesize
This is small text.
\normalsize
Here is some more.
\newpage
"""

The issue is that when I compile the strings, I get:

common_beginning
'{\x08f To:'

common_end
'}\n\n\x0cootnotesize\nThis is small text.\n\normalsize\nHere is some more.\n\newpage\n'

In this example, it is eating the \b and the \f at the beginning of the LaTeX tags "\bf" and "\footnotesize". In my actual document, it eats the \n from "\newpage" and the \t from "\textwidth" as well. In any case, the backslashes really seem to mess things up. Is there a way around this?