# [tex-live] Ignoring portion of LaTeX code; the \par problem.

Michaël Cadilhac michael at cadilhac.name
Sun Apr 4 19:37:00 CEST 2010

  Hi there everyone,

My goal today is to write a command that would include another TeX
file, but not its document environment.  For instance, I would want to
use it like:

document.tex:
\documentclass{article}
% Lots of includes and configurations.
\begin{document}
Text.
\end{document}

appendix.tex:
\usepreambleof{document.tex}
\begin{document}
Other text.
\end{document}

The goal there is to be able to move the appendix close to any
document.tex, and the appendix would take the form of the document.

My first tries were focused on just ignoring code.  But while I had no
succeed in defining \document=\iffalse and \enddocument=\fi, for
whatever reason, I might have found some bugs on my way, seemingly
linked to TeXlive.

1- The \par problem.  I do understand that a \par may break the system
by which arguments are parsed.  But how come this gives me an error:

\def\ignore#1{}
\ignore{\string\par}

or even

\ignore{\let\par=\relax}

2- The ^L matter.  Let's use the \ignore command again, but without
\par's.
\def\ignore#1{}
\ignore{one

two}

Of course, the paragraph ended before \ignore was complete.  I then ask
for lines and spaces to be obeyed with \obeylines\obeyspaces.  Now,
let's add a ^L character (C-q C-l in Emacs), which is used, e.g., as a
marker in a file for Emacs.

\obeylines\obeyspaces
\def\ignore#1{}
\ignore{one

two}

-> "Forbidden control sequence found while scanning use of \ignore."

If I add a \def^^L{}, everything works fine.  I'm just wondering why the
\obey* are not enough for that job.

Have a nice day.

--
Michaël Micha' Cadilhac (LITQ, U. de Montréal) -- http://michael.cadilhac.name
||     Emacs is GNU, Emacs is free
||     For more information,
||     Type C-h C-p

`

More information about the tex-live mailing list