Quantcast
Channel: Titlesec: Redefinition of sectioning command leads to endless execution of latex - TeX - LaTeX Stack Exchange
Viewing all articles
Browse latest Browse all 3

Titlesec: Redefinition of sectioning command leads to endless execution of latex

0
0

I'm new at TeX.SX and I hope I do everything correct.

To avoid answers like "Why do you do this?" I'd first like to describe briefly what I want: I'm developing a class based on tufte-book, which implements \subsubsection to throw an error. However, I'd like to provide the \subsubsection in my class. Furthermore, I'd like to be able to use the \titleformat macro to style the subsubsection since tufte-book uses titlesec. My first try was:

\documentclass{tufte-book}\makeatletter% Copy the definition from book.cls\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%                                 {-3.25ex\@plus -1ex \@minus -.2ex}%                                 {1.5ex \@plus .2ex}%                                 {\normalfont\normalsize\bfseries}}\makeatother% The following macro is called at the very end of titlesec.sty.% If I uncomment it, the latex process runs forever.%\titleclass{\subsubsection}{straight}[\subsection]% Without the optional argument, it works...% However, if you make the following line a comment...\titleclass{\subsubsection}{straight}% ... the access to subsubsection using the titlesec API doesn't work anymore \titleformat{\subsubsection}{%  \fontsize{36}{42}\selectfont%}{\thesubsubsection}{1em}{}[]\begin{document}  \subsection{bar}  \subsubsection{foo}\end{document}

After investigating titlesec.sty a bit, the MWE can be reduced to using the same call of \titleclass twice:

\documentclass{article}\usepackage[T1]{fontenc}\usepackage{titlesec}% runs forever%\titleclass{\subsubsection}{straight}[\subsection]% works\titleclass{\subsubsection}{straight}% Does not make sense, but works%\titleclass{\subsubsection}{straight}[\paragraph]\titleformat{\subsubsection}{%  \fontsize{36}{42}\selectfont%}{\thesubsubsection}{1em}{}[]\begin{document}  \subsection{bar}  \subsubsection{foo}\end{document}

While I believe that encountering an infinite loop is a good sign to have found a bug, I do neither find it nor I find any comments or threads on this issue in the net. I would agree that using the same \titleclass definition twice is something obscure, but it should at least result in an error instead of something infinite. Does anyone see the (potential) bug or, more likely, my mistake?


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images