Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when counting theorems in LaTeX #6734

Closed
brunoprietog opened this issue Oct 9, 2020 · 3 comments
Closed

Error when counting theorems in LaTeX #6734

brunoprietog opened this issue Oct 9, 2020 · 3 comments

Comments

@brunoprietog
Copy link

Hello! It happens that if in a LaTeX file you enter theorems in the following way,

\newtheorem{defi}[teo]{Definici\'on}
\newtheorem{teo}{Teorema}
\newtheorem{obs}[teo]{Observaci\'on}

\begin{document}
\begin{defi}
Definición 1
\end{defi}

\begin{teo}
Teorema 1
\end{teo}

\begin{obs}
Observación 1
\end{obs}

\end{document}

Pandoc 2.10.1 does the following when try convert to Markdown/Docx/HTML, and I suppose that with the rest of the formats as well:

Definici\'on 1: Definición 1

Teorema 2: Teorema 1

Observaci\'on 3: Observación 1

Being that it should stay this way:

Definición 1: Definición 1

Teorema 1: Teorema 1

Observación 1: Observación 1

This is incorrect, because there is only one definition, one theorem and one observation, but Pandoc considers the 3 as if they were the same.

The counter is counting all the theorems, without discriminating if they are different, such as definition, theorem, observation, among others. There should be separate counters, one for defi, another for teo, another for obs and so on, instead of one for all.

In addition, in the case of "definici'on" and "observaci'on" the letters with accents are being copied as they are, without replacing the accents correctly as would be expected, "definición", "observación".

Thanks!

jgm added a commit that referenced this issue Oct 9, 2020
Previously we were just treating it as a string and
ignoring  accents and formatting.  See #6734.
@jgm
Copy link
Owner

jgm commented Oct 9, 2020

I just fixed the accent issue. Still need to look into the numbering issue.

@jgm
Copy link
Owner

jgm commented Oct 10, 2020

Observations:

  1. Your input doesn't compile with pdflatex as it stands. I had to add a documentclass, but I also had to switch the order of the first two lines.

  2. When I did this, I got the following result:

Screen Shot 2020-10-09 at 5 58 05 PM

So it seems that pandoc is doing just what it should for this.

If you remove the [teo] after the commands, which tells the other theorem types that they belong in the series with Teorema, then they are all numbered 1 as you desire (both with pdflatex and with pandoc).

Conclusion: no bug, other than the one I fixed with the accents.

@jgm jgm closed this as completed Oct 10, 2020
@brunoprietog
Copy link
Author

@jgm Thank you very much for the research.
Yes, you are right. I didn't notice the documentclass. Reviewing it more closely, I realized that beamer doesn't list them. Maybe there could be a rule that avoids counting them when they are in a beamer. I leave an example that if you compile without modifications.

\documentclass[]{beamer}
\newtheorem{teo}{Theorem}
\newtheorem{defi}[teo]{Definition}
\newtheorem{obs}[teo]{Observation}
\begin{document}
\begin{frame}
\begin{defi}
This is a definition
\end{defi}
\begin{teo}
This is a theorem
\end{teo}
\begin{obs}
This is an observation
\end{obs}
\end{frame}
\end{document}

This produces:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants