muzimuzhi / ltx-pkg-ntheorem-issues Goto Github PK
View Code? Open in Web Editor NEWRecord issues/problems of latex package ntheorem
Record issues/problems of latex package ntheorem
From https://tex.stackexchange.com/a/654404.
LaTeX2e extended \label
to five data, the one previously used by hyperref
, see https://github.com/latex3/latex2e/pull/956
.
For \label{key}
,
% before, in .aux
\newlabel{key}{{<label>}{<page>}}
% after
\newlabel{key}{{<label>}{<page>}{<label name>}{<Href>}{<reserved>}}
xparse
, one need to use \cmd[{... ] ...}]
to reserve ]
used in the optional argument.\cmdB
, then \cmdB[{...}]
is always recommended. This way, the code works either ...
contains ]
or not.In the example from linked answer,
\documentclass{article}
\usepackage{ntheorem}
\newtheorem{thm}{Theorem}
\begin{document}
\begin{thm}[{\cite[page 10]{ABC2011}}]
\end{thm}
\begin{thebibliography}{9}
\bibitem{ABC2011} A bibitem.
\end{thebibliography}
\end{document}
the opt-arg of thm
env acts as the #3
of \@opargbegintheorem
, which is defined as
\gdef\th@plain{%
\def\theorem@headerfont{\normalfont\bfseries}\itshape%
\def\@begintheorem##1##2{%
\item[\hskip\labelsep \theorem@headerfont ##1\ ##2.]}%
\def\@opargbegintheorem##1##2##3{%
\item[\hskip\labelsep \theorem@headerfont ##1\ ##2\ (##3).]}}
Here \begin{thm}[{\cite[page 10]{ABC2011}}]
will expand to
\item[... \cite[page 10]{ABC2011} ...]
hence raises errors.
Short-term workaround would be:
\documentclass{article}
\usepackage{ntheorem}
\usepackage{regexpatch}
\newtheorem{thm}{Theorem}
\makeatletter
\regexpatchcmd*\th@plain
{\c{item}\cO\[(.*?\cO)\]}
{\c{item}\cO\[\cB\{\1\cE\}\cO\]}
{}{\fail}
\makeatother
\begin{document}
\begin{thm}[{\cite[page 10]{ABC2011}}]
A theorem.
\end{thm}
\begin{thebibliography}{9}
\bibitem{ABC2011} A bibitem.
\end{thebibliography}
\end{document}
Long-term fix is to use \item[{...}]
throughout the ntheorem.sty
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.