使用 todonotes 包会破坏 classicthesis 对齐修复

使用 todonotes 包会破坏 classicthesis 对齐修复

我对 classicthesis 中描述的目录设计有疑问这里,但我无法重现该解决方案。因此,我进行了一些测试,并确定冲突的包是 todonotes。

因此,如果我使用帖子中提到的修复方法,我的最小非工作示例是(请注意,如果删除它将起作用\usepackage{todonotes}

\RequirePackage{fix-cm}
\documentclass[ twoside,openright,titlepage,numbers=noenddot,headinclude,%1headlines,% letterpaper a4paper
                footinclude=true,cleardoublepage=empty,abstractoff, % <--- obsolete, remove (todo)
                BCOR=5mm,paper=a4,fontsize=11pt,%11pt,a4paper,%
                ngerman,american,%
                ]{scrreprt}

\input{classicthesis-config}

\usepackage{todonotes}

\makeatletter
\setlength\cftpartnumwidth{1.5em}
\renewcommand\Part[2][]{%
\addtocontents{toc}{\setcounter{tocdepth}{-2}}
\ifpdf\pdfstringdefDisableCommands{\let\thepart\@gobbletwo}%
  \oldpart[\texorpdfstring{\spacedlowsmallcaps{#1}}{#1}]{#2}
\else\oldpart[\spacedlowsmallcaps{#1}]{#2}%
\fi%
\addtocontents{toc}{\setcounter{tocdepth}{2}}%
\addcontentsline{toc}{part}{\protect\numberline{%
  \hspace*{4pt}\texorpdfstring{\llap{\thepart}}{}}\texorpdfstring{\noexpand\spacedlowsmallcaps{#1}}{#1}}
\ctparttext{\relax}%
}%
\makeatother

\begin{document}

\tableofcontents

\part{Test Part One}
\chapter{Test Chapter One}
\section{Test Section One One}
\section{Test Section One Two}
\part{Test Part Two}
\chapter{Test Chapter One}
\section{Test Section One One}
\section{Test Section One Two}
\part{Test Part Three}
\chapter{Test Chapter One}
\section{Test Section One One}
\section{Test Section One Two}

\end{document}

错误消息(来自 ShareLaTeX)是:

Missing number, treated as zero.
<to be read again> 
                   \begingroup 
l.7 ...oup \aftergroup \calc@B \calc@A \begingroup
                                                   \aftergroup \calc@B \calc...
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

! Missing number, treated as zero.
<to be read again> 
                   \afterassignment 
l.7 ...aftergroup \calc@B \calc@A \afterassignment
                                                   \def {\GenericError {(cal...
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
 output.toc, line 7
Undefined control sequence.
The compiler is having trouble understanding a command you have used. Check that the command is spelled correctly. If the command is part of a package, make sure you have included the package in your preamble using \usepackage{...}.

 Learn moreWas this hint helpful?Yes / No
\GenericError  ...                                
                                                  \let \@err@               ...
l.7 ...tion.}{I expected to see one of: + - * / )}
                                                  }\calc@A -2!\global \calc@...
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Missing { inserted.
<to be read again> 
                   \let 
l.7 ...tion.}{I expected to see one of: + - * / )}
                                                  }\calc@A -2!\global \calc@...
A left brace was mandatory here, so I've put one in.
You might want to delete and/or insert some corrections
so that I will find a matching right brace soon.
(If you're confused by all this, try typing `I}' now.)
 output.toc, line 9
LaTeX Error: Something's wrong--perhaps a missing \item.
There are no entries found in a list you have created. Make sure you label list entries using the \item command, and that you have not used a list inside a table.

 Learn moreWas this hint helpful?Yes / No
See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.9 ...cedlowsmallcaps {Test Part One}}{3}{part.1}

Try typing  <return>  to proceed.
If that doesn't work, type  X <return>  to quit.
 output.toc, line 11
Missing number, treated as zero.
<to be read again> 
                   \begingroup 
l.11 ...up \aftergroup \calc@B \calc@A \begingroup
                                                   \aftergroup \calc@B \calc...
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

! Missing number, treated as zero.
<to be read again> 
                   \afterassignment 
l.11 ...ftergroup \calc@B \calc@A \afterassignment
                                                   \def {\GenericError {(cal...
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
 output.toc, line 11
Undefined control sequence.
The compiler is having trouble understanding a command you have used. Check that the command is spelled correctly. If the command is part of a package, make sure you have included the package in your preamble using \usepackage{...}.

 Learn moreWas this hint helpful?Yes / No
\GenericError  ...                                
                                                  \let \@err@               ...
l.11 ...ion.}{I expected to see one of: + - * / )}
                                                  }\calc@A 2!\global \calc@A...
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Missing { inserted.
<to be read again> 
                   \let 
l.11 ...ion.}{I expected to see one of: + - * / )}
                                                  }\calc@A 2!\global \calc@A...
A left brace was mandatory here, so I've put one in.
You might want to delete and/or insert some corrections
so that I will find a matching right brace soon.
(If you're confused by all this, try typing `I}' now.)
 output.toc, line 13
LaTeX Error: Something's wrong--perhaps a missing \item.
There are no entries found in a list you have created. Make sure you label list entries using the \item command, and that you have not used a list inside a table.

 Learn moreWas this hint helpful?Yes / No
See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.13 ...edlowsmallcaps {Test Part One}}{5}{part.1}

Try typing  <return>  to proceed.
If that doesn't work, type  X <return>  to quit.
 output.toc, line 21
Missing number, treated as zero.
<to be read again> 
                   \begingroup 
l.21 ...up \aftergroup \calc@B \calc@A \begingroup
                                                   \aftergroup \calc@B \calc...
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

! Missing number, treated as zero.
<to be read again> 
                   \afterassignment 
l.21 ...ftergroup \calc@B \calc@A \afterassignment
                                                   \def {\GenericError {(cal...
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
 output.toc, line 21
Undefined control sequence.
The compiler is having trouble understanding a command you have used. Check that the command is spelled correctly. If the command is part of a package, make sure you have included the package in your preamble using \usepackage{...}.

 Learn moreWas this hint helpful?Yes / No
\GenericError  ...                                
                                                  \let \@err@               ...
l.21 ...ion.}{I expected to see one of: + - * / )}
                                                  }\calc@A -2!\global \calc@...
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Missing { inserted.
<to be read again> 
                   \let 
l.21 ...ion.}{I expected to see one of: + - * / )}
                                                  }\calc@A -2!\global \calc@...
A left brace was mandatory here, so I've put one in.
You might want to delete and/or insert some corrections
so that I will find a matching right brace soon.
(If you're confused by all this, try typing `I}' now.)
 output.toc, line 23
LaTeX Error: Something's wrong--perhaps a missing \item.
There are no entries found in a list you have created. Make sure you label list entries using the \item command, and that you have not used a list inside a table.

 Learn moreWas this hint helpful?Yes / No
See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.23 ...edlowsmallcaps {Test Part Two}}{7}{part.2}

Try typing  <return>  to proceed.
If that doesn't work, type  X <return>  to quit.
 output.toc, line 25
Missing number, treated as zero.
<to be read again> 
                   \begingroup 
l.25 ...up \aftergroup \calc@B \calc@A \begingroup
                                                   \aftergroup \calc@B \calc...
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

! Missing number, treated as zero.
<to be read again> 
                   \afterassignment 
l.25 ...ftergroup \calc@B \calc@A \afterassignment
                                                   \def {\GenericError {(cal...
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
 output.toc, line 25
Undefined control sequence.
The compiler is having trouble understanding a command you have used. Check that the command is spelled correctly. If the command is part of a package, make sure you have included the package in your preamble using \usepackage{...}.

 Learn moreWas this hint helpful?Yes / No
\GenericError  ...                                
                                                  \let \@err@               ...
l.25 ...ion.}{I expected to see one of: + - * / )}
                                                  }\calc@A 2!\global \calc@A...
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Missing { inserted.
<to be read again> 
                   \let 
l.25 ...ion.}{I expected to see one of: + - * / )}
                                                  }\calc@A 2!\global \calc@A...
A left brace was mandatory here, so I've put one in.
You might want to delete and/or insert some corrections
so that I will find a matching right brace soon.
(If you're confused by all this, try typing `I}' now.)
 output.toc, line 27
LaTeX Error: Something's wrong--perhaps a missing \item.
There are no entries found in a list you have created. Make sure you label list entries using the \item command, and that you have not used a list inside a table.

 Learn moreWas this hint helpful?Yes / No
See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.27 ...edlowsmallcaps {Test Part Two}}{9}{part.2}

Try typing  <return>  to proceed.
If that doesn't work, type  X <return>  to quit.
 output.toc, line 35
Missing number, treated as zero.
<to be read again> 
                   \begingroup 
l.35 ...up \aftergroup \calc@B \calc@A \begingroup
                                                   \aftergroup \calc@B \calc...
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

! Missing number, treated as zero.
<to be read again> 
                   \afterassignment 
l.35 ...ftergroup \calc@B \calc@A \afterassignment
                                                   \def {\GenericError {(cal...
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
 output.toc, line 35
Undefined control sequence.
The compiler is having trouble understanding a command you have used. Check that the command is spelled correctly. If the command is part of a package, make sure you have included the package in your preamble using \usepackage{...}.

 Learn moreWas this hint helpful?Yes / No
\GenericError  ...                                
                                                  \let \@err@               ...
l.35 ...ion.}{I expected to see one of: + - * / )}
                                                  }\calc@A -2!\global \calc@...
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Missing { inserted.
<to be read again> 
                   \let 
l.35 ...ion.}{I expected to see one of: + - * / )}
                                                  }\calc@A -2!\global \calc@...
A left brace was mandatory here, so I've put one in.
You might want to delete and/or insert some corrections
so that I will find a matching right brace soon.
(If you're confused by all this, try typing `I}' now.)
 output.toc, line 37
LaTeX Error: Something's wrong--perhaps a missing \item.
There are no entries found in a list you have created. Make sure you label list entries using the \item command, and that you have not used a list inside a table.

 Learn moreWas this hint helpful?Yes / No
See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.37 ...owsmallcaps {Test Part Three}}{11}{part.3}

Try typing  <return>  to proceed.
If that doesn't work, type  X <return>  to quit.
 output.toc, line 39
Missing number, treated as zero.
<to be read again> 
                   \begingroup 
l.39 ...up \aftergroup \calc@B \calc@A \begingroup
                                                   \aftergroup \calc@B \calc...
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

! Missing number, treated as zero.
<to be read again> 
                   \afterassignment 
l.39 ...ftergroup \calc@B \calc@A \afterassignment
                                                   \def {\GenericError {(cal...
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
 output.toc, line 39
Undefined control sequence.
The compiler is having trouble understanding a command you have used. Check that the command is spelled correctly. If the command is part of a package, make sure you have included the package in your preamble using \usepackage{...}.

 Learn moreWas this hint helpful?Yes / No
\GenericError  ...                                
                                                  \let \@err@               ...
l.39 ...ion.}{I expected to see one of: + - * / )}
                                                  }\calc@A 2!\global \calc@A...
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Missing { inserted.
<to be read again> 
                   \let 
l.39 ...ion.}{I expected to see one of: + - * / )}
                                                  }\calc@A 2!\global \calc@A...
A left brace was mandatory here, so I've put one in.
You might want to delete and/or insert some corrections
so that I will find a matching right brace soon.
(If you're confused by all this, try typing `I}' now.)
 output.toc, line 41
LaTeX Error: Something's wrong--perhaps a missing \item.
There are no entries found in a list you have created. Make sure you label list entries using the \item command, and that you have not used a list inside a table.

 Learn moreWas this hint helpful?Yes / No
See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.41 ...owsmallcaps {Test Part Three}}{13}{part.3}

Try typing  <return>  to proceed.
If that doesn't work, type  X <return>  to quit.
 ClassicThesis.tex, line 60
Missing } inserted.
<inserted text> 
                }
l.60 \tableofcontents

I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.
 ClassicThesis.tex, line 60
Missing number, treated as zero.
<to be read again> 
                   \tb@toc@after@hook 
l.60 \tableofcontents

A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
 ClassicThesis.tex, line 60
Missing number, treated as zero.
<to be read again> 
                   \endgroup 
l.60 \tableofcontents

A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
 ClassicThesis.tex, line 61
Missing number, treated as zero.
<to be read again> 
                   \par 
l.61 

A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
 ClassicThesis.tex, line 62
Undefined control sequence.
The compiler is having trouble understanding a command you have used. Check that the command is spelled correctly. If the command is part of a package, make sure you have included the package in your preamble using \usepackage{...}.

 Learn moreWas this hint helpful?Yes / No
\@calc@post@scan ...st@scan \else \def \calc@next 
                                                  {\calc@error #1}\fi \fi \f...
l.62 \part{Test Part One}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
 ClassicThesis.tex, line 62
Undefined control sequence.
The compiler is having trouble understanding a command you have used. Check that the command is spelled correctly. If the command is part of a package, make sure you have included the package in your preamble using \usepackage{...}.

 Learn moreWas this hint helpful?Yes / No
\@calc@post@scan ...fi \fi \fi \fi \fi \calc@next 

l.62 \part{Test Part One}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
 ClassicThesis.tex, line 66
Undefined control sequence.
The compiler is having trouble understanding a command you have used. Check that the command is spelled correctly. If the command is part of a package, make sure you have included the package in your preamble using \usepackage{...}.

 Learn moreWas this hint helpful?Yes / No
\@calc@post@scan ...st@scan \else \def \calc@next 
                                                  {\calc@error #1}\fi \fi \f...
l.66 \part{Test Part Two}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
 ClassicThesis.tex, line 66
Undefined control sequence.
The compiler is having trouble understanding a command you have used. Check that the command is spelled correctly. If the command is part of a package, make sure you have included the package in your preamble using \usepackage{...}.

 Learn moreWas this hint helpful?Yes / No
\@calc@post@scan ...fi \fi \fi \fi \fi \calc@next 

l.66 \part{Test Part Two}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
 ClassicThesis.tex, line 70
Undefined control sequence.
The compiler is having trouble understanding a command you have used. Check that the command is spelled correctly. If the command is part of a package, make sure you have included the package in your preamble using \usepackage{...}.

 Learn moreWas this hint helpful?Yes / No
\@calc@post@scan ...st@scan \else \def \calc@next 
                                                  {\calc@error #1}\fi \fi \f...
l.70 \part{Test Part Three}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
 ClassicThesis.tex, line 70
Undefined control sequence.
The compiler is having trouble understanding a command you have used. Check that the command is spelled correctly. If the command is part of a package, make sure you have included the package in your preamble using \usepackage{...}.

 Learn moreWas this hint helpful?Yes / No
\@calc@post@scan ...fi \fi \fi \fi \fi \calc@next 

l.70 \part{Test Part Three}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

答案1

todonotes 包加载包,并以它们在命令中中断的方式calc重新定义。保护它们:\setcounter\addtocontents

 \addtocontents{toc}{\protect\setcounter{tocdepth}{-2}

相关内容