在 reledpar 项目中,我希望某些部分在目录中显示的名称与在正文中显示的名称不同。通常这很简单: 。但是,如果在 reledpar ( ) 或 reledmac ( )\section[name in TOC]{name in body}
中尝试这样做,则会产生错误。Argument of \ttl@straight@i has an extra }
Incomplete \iffalse
有没有办法让这个分段功能在 reledpar 中工作?通过 titlesec 和 titletoc 可能是一种替代解决方案,但它会更复杂。
梅威瑟:
\documentclass{article}
\usepackage{reledmac, reledpar}
\begin{document}
\tableofcontents
\begin{pages}
\begin{Leftside}
\beginnumbering
%% the line below gives an error `Argument of \ttl@straight@i has an extra }`
%% (error even if the right side too has differentiated TOC and body section names to match these)
%\pstart[\section[Left section in TOC]{Left section in body}]
\pstart[\section{Left section}]
Left paragraph.
\pend
\endnumbering
\end{Leftside}
\begin{Rightside}
\beginnumbering
\pstart[\section{Right section}]
Right paragraph.
\pend
\endnumbering
\end{Rightside}
\end{pages}
\Pages
%\beginnumbering
%% the line below gives an error `Incomplete \iffalse`
% \pstart[\section[Reledmac section in TOC]{Reledmac section in body}]
% A reledmac paragraph.
% \pend
%\endnumbering
% no error outside of reledpar and reledmac
\section[Non-reledpar section in TOC]{Non-reledpar section in body}
\end{document}
答案1
这是扩展的问题。我现在没时间去理解 reledmac 代码中的问题(你可以开一个问题),但有一个\unexpanded
解决方法。
\documentclass{article}
\usepackage{reledmac, reledpar}
\begin{document}
\tableofcontents
\beginnumbering
\pstart[\unexpanded{\section[reledmac section in toc]{reledmac section in body}}]
a reledmac paragraph.
\pend
\endnumbering
% no error outside of reledpar and reledmac
\section[Non-reledpar section in TOC]{Non-reledpar section in body}
\end{document}