Arash Esbati <[email protected]> writes: > Daniel Kessler <[email protected]> writes: > >> However, the problem isn't really with todonotes specifically, as can >> be appreciated with the following two MWE latex files that demonstrate >> the crux of the issue with chapter without involving todonotes at >> all. > > First of all, many thanks for your report and sorry for the late > response. > >> The first yields an error, the second compiles cleanly. They differ >> only in whether the preview package is active or not. >> >> \documentclass{article} >> \usepackage[active,sections]{preview} >> \begin{document} >> \makeatletter >> \@ifundefined{chapter}{\section{Section One}}{\chapter{Chapter One}} >> \makeatother >> \end{document} >> >> vs >> >> \documentclass{article} >> \usepackage[inactive,sections]{preview} >> \begin{document} >> \makeatletter >> \@ifundefined{chapter}{\section{Section One}}{\chapter{Chapter One}} >> \makeatother >> \end{document} >> >> Compiling the first yields >> >> ! Undefined control sequence. >> <argument> \pr@\chapter >> {Chapter One} >> l.7 ...ection{Section One}}{\chapter{Chapter One}} >> >> I think this could be fixed by adding some logic into around where the >> sections options is declared so that >> >> \PreviewMacro[*[[!]{\chapter}%]] >> >> is run *only* if \chapter is already defined. Perhaps there's some >> additional logic that be built into the \PreviewMacro instead, but the >> code used in that definition exceeds my understanding of (la)tex. > > If you try this snippet: > > \documentclass{article} > \usepackage[active,sections, > auctex % Option added > ]{preview} > \begin{document} > \makeatletter > \@ifundefined{chapter}{\section{Section One}}{\chapter{Chapter One}} > \makeatother > \end{document} > > the file prauctex.def is loaded which usually happens during the preview > generation inside Emacs, and that file contains: > > \preview@delay{\@ifundefined{pr@\string\chapter}{% > \PreviewMacro*[*][#1{}]\chapter}{}} > > But even so, the issue you describe happens again (differently) and > there are no previews inside Emacs. > > I think the easiest way to circumvent this is by wrapping the > \listoftodos command inside the \ifPreview conditional in your .tex > file: > > \documentclass{article} > \usepackage{todonotes} > \usepackage[sections]{preview} > \begin{document} > > \ifPreview \else \listoftodos \fi > > \section{Section One} > \end{document} > > The code in preview.sty also exceeds my understanding of (la)tex, so > this is the best I can offer and I'm afraid this report is a wontfix. > > Again, thanks for your report and sorry for the late response.
No further comments, so I'm closing this report. At least we have a work around. Best, Arash _______________________________________________ bug-auctex mailing list [email protected] https://lists.gnu.org/mailman/listinfo/bug-auctex
