[texhax] tabularx and titletoc/titlesec: harmful interaction? [workaround]

Susan Dittmar Susan.Dittmar at gmx.de
Wed Jul 18 12:04:50 CEST 2012

Hi folks,

I still do not understand why the described problem arised, and in case
someone knows, I am still interested in an explanation.

Nonetheless using etoolbox and a macro instead of the counter I managed to
work around the problem (work-around appended for the archives). Btw, I
first used etoolbox's \numdef, which showed the same problem although
according to the docs it is a local definition!




\newcommand{\mysecdepth}{0}	% register to keep track of current section depth
	\expandafter\numdef\expandafter\mysecdepth{\mysecdepth + 1}	% locally add 1 to register \mysecdepth
		\immediate\write16{mysection: counter mysecdepth has value 0! This can't happen!}%
		\immediate\write16{mysection: No more hierarchy levels!}%


\begin{mysection}{first section}
	text of first section
	\begin{mysection}{first subsection of first section}
	text of first subsection of first section

\begin{mysection}{second section}
	text of second section

\begin{mysection}{third section}
	text of third section

	This is a tabularx \\
	just to show my problem.\\

\begin{mysection}{fourth section}
	text of fourth section, which falsely was chosen to
	be first subsection of section three, but now correctly
	seen as section four


More information about the texhax mailing list