diff options
| author | Hikaru Ibayashi <ibayashi@usc.edu> | 2023-11-17 18:49:03 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-17 18:49:03 -0800 |
| commit | a3fba6d83e86978d91a913a3113bb3db92195298 (patch) | |
| tree | f101f818403b525007c17b007982957302851b27 /test/command | |
| parent | 267b84e1d987b5065263cbe5899248c04d055678 (diff) | |
LaTeX reader: fix theorem label parsing (#9198)
Closes #8872.
In the current implementation , theorem labels in `theoremEnvironment` are
determined by the `LastLabel` in the current state.
This approach works well when the `\label{label_name}` is placed at the end
of the theorem body. However, when a label is placed at the beginning of the
theorem (another common practice) and additional labels follow in the theorem body,
`theoremEnvironment` incorrectly picks the last label (e.g., `\label{item2}` in #8872).
This patch addresses the issue by extracting the label extraction independently of the `LastLabel` state.
Diffstat (limited to 'test/command')
| -rw-r--r-- | test/command/8872.md | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/test/command/8872.md b/test/command/8872.md new file mode 100644 index 000000000..fddcb3c47 --- /dev/null +++ b/test/command/8872.md @@ -0,0 +1,45 @@ + +``` +% pandoc -f latex -t native +\documentclass{amsart} +\newtheorem{theorem}{Theorem} +\begin{document} +\begin{theorem}\label{thm} +\begin{enumerate} +\item \label{item1}text1 +\item \label{item2}text2 +\item text3 +\end{enumerate} +\end{theorem} +\end{document} +^D +[ Div + ( "thm" , [ "theorem" ] , [] ) + [ Para + [ Strong [ Str "Theorem" , Space , Str "1" ] + , Str "." + , Space + , Space + , Emph [] + ] + , OrderedList + ( 1 , DefaultStyle , DefaultDelim ) + [ [ Para + [ Emph + [ Span ( "item1" , [] , [ ( "label" , "item1" ) ] ) [] + , Str "text1" + ] + ] + ] + , [ Para + [ Emph + [ Span ( "item2" , [] , [ ( "label" , "item2" ) ] ) [] + , Str "text2" + ] + ] + ] + , [ Para [ Emph [ Str "text3" ] ] ] + ] + ] +] +``` |
