0

I'm trying to deal with the same problem as described here. But the accepted answer does not really help in my case since the problem occurs when I try to add hierarchical numbering to listings and I need a solution that will still let me write

\counterwithin{listing}{chapter}

in my preamble. How can I achieve this? I cannot really wait for this to be patched or downgrade at the moment.

Peter
  • 178
  • you don't have to wait it was fixed in the patch level 3 release and there have been two releases since then (current release is 2018-04-01 patch level 5) – David Carlisle Jun 28 '18 at 16:19
  • This has already been fixed. Did you upgrade your latex installation. – daleif Jun 28 '18 at 16:19
  • I'm using pdfTeX 3.14159265-2.6-1.40.19 (installed on Arch via pacman). Which version do I need? – Peter Jun 28 '18 at 17:05
  • 2
    We need to know exactly what you installed not which version of the binary, latex runs on top of the binary. Are there any latex related updates in arch? Generally I don't recommend getting latex from a Linux fist as they tend to quite behind on their updates, in this case there was an error in the initial release, an error that has already been fixed upstream. I have no idea when arch will pick up any updates. I generally use the upstream latex directly, tug.org/texlive – daleif Jun 28 '18 at 17:13
  • According to arch docs they should follow updates, but I don't know anything about how to do things in arch – daleif Jun 28 '18 at 17:15
  • 1
    when latex starts up it gives a banner on the terminal and log of the form LaTeX2e <2018-04-01> patch release 5 The bug that you refer to should not be there for releases from patch release 3 onwards – David Carlisle Jun 28 '18 at 17:47
  • Ah yes, for me this is patch level 2 so I will probably have to install the upstream version, thank you. – Peter Jun 28 '18 at 18:17
  • @DavidCarlisle If it's in texlive-core, it should be patched on Arch. I assume this would affect the binaries. texlive-core is 2018.47471-1 which I assume means committ 47471, though I'm not sure as I don't use distro-packaged TL. – cfr Jun 28 '18 at 22:40
  • @cfr it's not a binaries issue it is a single . missing from latex.ltx – David Carlisle Jun 28 '18 at 22:54
  • installing a whole new tex distribution seems a heavyweight solution to a single missing ' in one macro. – David Carlisle Jun 28 '18 at 22:58
  • @Peter What does pacman -Qi texlive-core return? – cfr Jun 28 '18 at 23:04

1 Answers1

1

This was a bug in a latex release that was only distributed for less than 2 weeks before a fix was posted. If you are still waiting for your tex distribution to get 2018-04-01 patch level 3 (and 4 and 5) then the fix is literally a one . change, just add this to your preamble

\makeatletter
\def\counterwithin@x#1#2{%
  \@ifbothcounters{#1}{#2}%
      {\@addtoreset{#1}{#2}%
       \expandafter
       \gdef\csname the#1\expandafter\endcsname\expandafter
            {\csname the#2\expandafter\endcsname\expandafter
             .\expandafter
           %^^^
             \@arabic\csname c@#1\endcsname}}}
\makeatother
David Carlisle
  • 757,742