0

I'm using LyX.

The code \end{nolinenumbers} is not working for Table of Contents.

Who can help?

enter image description here

enter image description here

% Quellcode vorschauen

%% LyX 2.0.8.1 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[12pt,ngerman]{extarticle}
\usepackage[T1]{fontenc}
\usepackage[utf8x]{inputenc}
\usepackage[a4paper]{geometry}
\geometry{verbose,tmargin=2cm,bmargin=2cm,lmargin=3cm,rmargin=3cm}
\usepackage{color}
\usepackage{babel}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{setspace}
\onehalfspacing
\usepackage[unicode=true,pdfusetitle,
 bookmarks=true,bookmarksnumbered=false,bookmarksopen=false,
 breaklinks=true,pdfborder={0 0 0},backref=false,colorlinks=true]
 {hyperref}

\makeatletter
\@ifundefined{date}{}{\date{}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.

\usepackage{etoolbox}\usepackage{lineno}% http://ctan.org/pkg/{etoolbox,lineno}
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\setlength{\linenumbersep}{10pt}
\renewcommand{\linenumberfont}{\normalfont\tiny\sffamily\color{gray}}


% \patchcmd{}{}{}{}{}
\patchcmd{\@startsection}{\@ifstar}{\nolinenumbers\@ifstar}{}{}
\patchcmd{\@xsect}{\ignorespaces}{\linenumbers\ignorespaces}{}{}

\linenumbers

\usepackage{xcolor}\usepackage{lscape}

\usepackage{tocstyle}\usepackage{enumitem}\usepackage{mathabx}\usepackage{color}\usepackage{soulutf8}\usepackage{microtype}

\renewcommand{\labelenumi}{\arabic{enumi}.}
\renewcommand{\labelenumii}{\labelenumi\arabic{enumii}.}
\renewcommand{\labelenumiii}{\labelenumii\arabic{enumiii}}
\renewcommand{\labelenumiv}{\alph{enumiv})}


\newtocstyle[KOMAlike][leaders]{chapterwithdot}{
  \settocfeature{pagenumberbox}{\makebox[1em][r]}% Platz für Seitenzahl
  \settocfeature[-1]{leaders}{\hfill}% keine Punkte bei part
  \settocfeature[-1]{pagenumberbox}{\phantom}% keine Seitenzahl bei part
  }
\usetocstyle{chapterwithdot}

\renewcommand{\arraystretch}{0.9}

\makeatother

\begin{document}
\newpage{}\begin{nolinenumbers} \tableofcontents{}\end{nolinenumbers}

\clearpage\pagenumbering{arabic}

\setcounter{page}{6}\newpage{}


\section{weijfwoijfewfe}


\subsection{wefijwoijfeoiwfe}
\begin{quote}
\begin{singlespace}
\noindent joiwjeoiwjfoiwjfe\end{singlespace}

\end{quote}

\subsection{wfejwojfeowijfowf}

woiujfeoiwjfeoiwjfeoiwfe
\end{document}
Troy
  • 13,741
  • Is there someone who can help? –  Sep 06 '18 at 17:35
  • It work for me, so without more information we can only guess. Reduce your document as far as possible while still produce the problem and then paste in your question the complete LaTeX source (export to pdflatex or copy it from View > Code Preview Pane > Complete source. It should be some like \documentclass{article} \usepackage{lineno} \begin{document} \linenumbers \begin{nolinenumbers} \tableofcontents{} \end{nolinenumbers} \section{aaaa}xxxxx\section{bbbb}zzzz \end{document} – Fran Sep 10 '18 at 23:01
  • Does that help? See first post. –  Sep 11 '18 at 15:31
  • Hi, thanks, but I dont understand. There is non makeatletter in my preamble. –  Sep 11 '18 at 17:18
  • There are always a \makeatletter as in the code that yourself have posted whenever you add something to the preamble with Document > Settings > Latex Preamble, but that command is in the non visible part of the preamble. To be clear, the preamble that you can edit is only the part between that \makeatletter and the \makeatother (that also is invisible). – Fran Sep 11 '18 at 18:46
  • Sorry, I do not explained well in my first comment. The problem is that \usepackage{etoolbox} is between \makeatletter and \makeatother. Moving the package just before of just after that commands solve the problem. Unfortunately, editing the preamble in LyX only allow put packages in that \makeatletter ... \makeatother zone but you have a solution here. – Fran Sep 11 '18 at 19:01
  • So what should I put in the "Local Layout"-field? –  Sep 13 '18 at 10:43
  • I'm afraid so, although I have not tried it. The 99% of the time is enough with the layouts available for standard document classes, but if you need more control over the preamble or use another kind of document, most probably you will need to entangle with the layouts . Avoid these layouts is a main reason for me to edit LaTeX directly instead of using LyX. – Fran Sep 13 '18 at 11:50

0 Answers0