So I have been using a custom setup of counters after some great help on here (thank you, egreg).

The thing is, I have been running into a really odd problem with the counters which I am just unable to reproduce and pinpoint in a reliable way. But I finally have found the culprits... I think.

Is there a way I can use libertine and amsmath in a reliable fashion so I do not have this experience? Or did I perhaps mis-configure som

Picture 1 with counters not working

Compiled with amsmath and libertine loaded so the counters do not work:

enter image description here

Picture 2 with counters working

Compiled with amsmath and libertine commented out:

enter image description here


% !TeX spellcheck = de_DE


%%% the problematic package

%%%%%%%%%%    A4    %%%%%%%%%%%%%
\newcounter{TOTALcounter} % for 'total' counters
% initialize the total counters

\newcommand{\personone}{\subsection{Stuff by Person1}}
\newcommand{\stufftwo}{\subsection{Stuff by Person2}}
\newcommand{\stuffthree}{\subsection{Stuff by Person3}}









  • libertine is not involved. Load amsmath before xcntperchap and hope that this doesn't break the amsmath usage of the counters. – Ulrike Fischer Jun 13 '20 at 16:18
  • @UlrikeFischer Could you please provide your comment as a reply so I could mark the thread/problem as solved? (And yes, I do really hope and pray that this issue won't pop up again!). – henry Jun 13 '20 at 16:30
  • If you compile this on XeLaTeX or LuaLaTeX, libertine will load fontspec` and prevent either tgheros or beramono from working. You can fix this either by loading those in fontspec as well (\defaultfontfeatures{Scale = MatchLowercase} \setsansfont{TeX Gyre Heros} \setmonofont{DejaVu Sans Mono}) or by adding the type1 option to libertine. – Davislor Jun 13 '20 at 20:46
  • Unrelated to your problem, as Ulrike Fischer said, but something to be aware of. – Davislor Jun 13 '20 at 20:54
  • @Davislor ... well ok, thanks, but this is clearly outside of the scope of this thread. – henry Jun 15 '20 at 7:57

amsmath (or more precisely amstext) redefines \stepcounter and so overwrites the changes from xcntperchap. If you load amsmath before xcntperchap it will probably work (if the additions of xcntperchap don't confuse amsmath somewhere.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.