I'm using XeLaTeX compiler to create my pdf documents.
Recently I had to adjust some lengths in tocloft table of contents, for example I tried changing \cftbeforechapskip
using \setlength
command -- but I keep getting two errors: Undefined control sequence and Missing \begin{document}.
Please note that I have to have Times font in my document (so I included the way I set it up in code example).
Using \setlength
with other (not tocloft) lengths sometimes gives warnings but works nevertheless.
Here is my code example:
%------------------ basic document settings -------------------------------
\documentclass[14pt]{article} % шрифт и формат документа
\usepackage{polyglossia}
\setmainlanguage{russian}
\setmainfont[]{Times New Roman}
%------------------ ToC setup -------------------------------------------------------
\usepackage{tocloft}
\setlength{\cftbeforechapskip}{0cm} %this line gives errors
\author{Мамонтов Иван, Т12О-402Б-20}
%----------------------------------------------------------------------------------------
\begin{document}
\tableofcontents
\section{Part one}
\subsection{Subpart one}
\section{Part two}
\end{document}
This code example produces log file with these errors:
LaTeX Error: Missing \begin{document}. l.9 \setlength{\cftbeforechapskip}{0cm}
Undefined control sequence. \cftbeforechapskip l.9 \setlength{\cftbeforechapskip}{0cm}
LaTeX Warning: Unused global option(s): [14pt].
article
that has no chapters. Unrelated, there is no14pt
option for article.Undefined control sequence. \cftbeforechapskip
, which has been explained by @egreg. The other message,Missing \begin{document}.
, is just a consequence of this error. So either use the document classreport
instead ofarticle
, or don't use\cftbeforechapskip
, as there will be no chapters.