jspitz / covington

Maintenance of the covington LaTeX package
9 stars 0 forks source link

Display not in accord with \renewcommand\theequation{} #16

Closed Marcool04 closed 10 months ago

Marcool04 commented 10 months ago

Hi there,

I have been trying to get example numbering to display in the form 1.1, 1.2, 2.1, 2.2, 2.3 etc. where the fist digit is the chapter number. I have the following MWE:

\NeedsTeXFormat{LaTeX2e}
\documentclass{scrbook}

\usepackage[utf8]{inputenc}
\usepackage[TS1,T1]{fontenc}

\usepackage{covington}
\counterwithin*{equation}{chapter}
\renewcommand\theequation{\thechapter.\arabic{equation}}
\usepackage{hyperref}

\begin{document}

  \newcounter{thiscounter}
  \renewcommand\thethiscounter{\thechapter.\arabic{thiscounter}}
  \setcounter{thiscounter}{1}

  \chapter{Chapter}

    This is a reference to interlinear~\ref{ex}, and my counter
    looks like this: \thethiscounter{}.

    \begin{example}
      \digloss{Word}
              {gloss}
              {translation}%
      \label{ex}
    \end{example}

  \chapter{Another Chapter}

    \stepcounter{thiscounter}

    This is a reference to another interlinear~\ref{otherex},
    but---oh no!---how do I tell it apart from a reference to
    interlinear~\ref{ex}, when my counter looks like this:
    \thethiscounter{}!

    \begin{example}
      \digloss{Anotherword}
              {anothergloss}
              {anothertranslation}%
      \label{otherex}
    \end{example}

\end{document}

I have included thiscounter as an illustration of what the behavior I would have expected is. It seems to me that this line: \renewcommand\theequation{\thechapter.\arabic{equation}} is being ignored or squashed somewhere by covington.

Thanks in advance for you help, Best, Mark.

jspitz commented 10 months ago

A bug. Will be fixed in the next release (just submitted to CTAN)

Marcool04 commented 10 months ago

@jspitz awesome! Thanks a lot for the quick fix. Tested to be working now with my previous MWE. However, there still seems to be an issue when using covex as the counter with the owncounter option, as in:

\NeedsTeXFormat{LaTeX2e}
\documentclass{scrbook}

\usepackage[utf8]{inputenc}
\usepackage[TS1,T1]{fontenc}

\usepackage[owncounter]{/home/mark/Downloads/covington}
\counterwithin*{covex}{chapter}
\renewcommand\thecovex{\thechapter.\arabic{covex}}
\usepackage{hyperref}

\begin{document}

  \newcounter{thiscounter}
  \renewcommand\thethiscounter{\thechapter.\arabic{thiscounter}}
  \setcounter{thiscounter}{1}

  \chapter{Chapter}

    This is a reference to interlinear~\ref{ex}, and my counter
    looks like this: \thethiscounter{}.

    \begin{example}
      \digloss{Word}
              {gloss}
              {translation}%
      \label{ex}
    \end{example}

  \chapter{Another Chapter}

    \stepcounter{thiscounter}

    This is a reference to another interlinear~\ref{otherex},
    but---oh no!---how do I tell it apart from a reference to
    interlinear~\ref{ex}, when my counter looks like this:
    \thethiscounter{}!

    \begin{example}
      \digloss{Anotherword}
              {anothergloss}
              {anothertranslation}%
      \label{otherex}
    \end{example}

\end{document}

Or am I missing something here?

jspitz commented 10 months ago

A quick fix (that is not included in the next release) has been submitted to the repo. However, as soon as you use the numberformat option, any previous definition of \thecovex will be (needs to be) overwritten.

Note that with owncounter, redefining \theequation is senseless, as a different counter is used here.

Marcool04 commented 10 months ago

Sorry, I edited the MWE after copy/pasting it and messed up (I fixed it up now).

Indeed, I was redefining \thecovex not \theequation.

And HEAD is verified to be working even with the owncounter option 👍️