2009-06-15 3 views
1

Вот мой минимальный LaTeX документ:Почему использование ledpar приводит к сбою документа?

\documentclass{article} 

\usepackage[polutonikogreek,english]{babel} 
\newcommand{\Gk}[1]{\selectlanguage{polutonikogreek}#1\selectlanguage{english}} 

\usepackage{ledmac} 
\newcommand{\cn}[1]{\Afootnote{#1}} 

\usepackage{ledpar} 

\begin{document} 
\beginnumbering 
\pstart 
\edtext{apostle}{\cn{\Gk{apostoloc}}} 
\pend 
\endnumbering 
\end{document} 

Выполнение latex test.tex производит следующее сообщение об ошибке:

... 
Section 1 (./test.1) 
! Missing control sequence inserted. 
<inserted text> 
       \inaccessible 
l.15 \pend 

? 

Некоторые примечания:

  1. DVI производства выглядит прекрасно, несмотря на ошибки.

  2. Замечание \usepackage{ledpar} устраняет проблему.

  3. Неиспользование команды \Gk также решает проблему. (Но как-то поражает цель иметь сноску.)

Что происходит здесь и как обойти сообщение об ошибке?

ответ

1

Согласно FAQ:

Sometimes LaTeX saves data it will reread later. These data are often the argument of some command; they are the so-called moving arguments. (‘Moving’ because data are moved around.) Candidates are all arguments that may go into table of contents, list of figures, etc.; namely, data that are written to an auxiliary file and read in later. Other places are those data that might appear in head- or footlines. Section headings and figure captions are the most prominent examples; there’s a complete list in Lamport’s book (see TeX-related books).

What’s going on really, behind the scenes? The commands in moving arguments are normally expanded to their internal structure during the process of saving. Sometimes this expansion results in invalid TeX code, which shows either during expansion or when the code is processed again. Protecting a command, using “\protect\cmd” tells LaTeX to save \cmd as \cmd, without expanding it at all.

Так командование \Gk получает расширилось слишком рано в процессе TeXing файлов и результаты в незаконном коде. Самое простое решение объявить команду надежную:

\usepackage{makerobust} 
\DeclareRobustCommand{\Gk}[1]{\selectlanguage{polutonikogreek}#1\selectlanguage{english}} 

Как почему использование ledpar пакета производит ошибку, я менее уверен. Чтобы облегчить заметки как на левой, так и на правой стороне параллельного текста, пакет ledpar должен переопределять практически любую команду, предоставляемую пакетом ledmac. Хотя я не нашел разницы в нарушении, одно или несколько переопределений должны преждевременно расширять хрупкие команды.

Смежные вопросы