作为我的另一个问题的必然结果法语章节编号使用 bis、ter 等“,我正在寻找一种通过在方程编号后附加“bis”、“ter”和其他拉丁后缀来编号方程的方法。
下图说明了所需的输出。请注意斜体之二和之三在方程式数字中。
我能够通过以下 MWE 实现这一点:
\documentclass[letterpage,12pt]{book}
\usepackage{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[hyphenation,parindent,lastparline]{impnattypo}
\usepackage[all]{nowidow}
\raggedbottom
\usepackage{verbatim}
\usepackage{amsmath,amsthm,amssymb}
\usepackage[frenchb]{babel}
\begin{document}
Equation no. 1 to follow.
\begin{equation}
(\lambda + \mu) \frac{d\theta}{dx} + \mu\Delta_2u
\end{equation}
Equation no. 1 \textit{bis} to follow
\begin{equation}\tag{1 \textit{bis}}
\theta = \frac{du}{dx} + \frac{dv}{dy} + \frac{d\eta}{dz}
\end{equation}
Equation no. 2 to follow.
\begin{equation}
y = mx + b \\[0.5em]
\end{equation}
Equation no. 2 \textit{bis} to follow
\begin{equation}\tag{2 \textit{bis}}
a^2 + b^2 = c^2
\end{equation}
Equation no. 2 \textit{ter} to follow
\begin{equation}\tag{2 \textit{ter}}
E = mc^2
\end{equation}
Equation no. 3 to follow
\begin{equation}
e^{\pi i}=-1
\end{equation}
Equation no. 4 to follow
\begin{equation}
\cos^2{x} + \sin^2{x} = 1
\end{equation}
\end{document}
但是,这种语法缺少我想要保留的自动方程编号功能。
下面的 MWE 是我的非工作示例,我正在尝试编辑它以实现所需的输出。
\documentclass[letterpage,12pt]{book}
\usepackage{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[hyphenation,parindent,lastparline]{impnattypo}
\usepackage[all]{nowidow}
\raggedbottom
\usepackage{verbatim}
\usepackage{amsmath,amsthm,amssymb}
\usepackage[frenchb]{babel}
\begin{document}
Equation no. 1 to follow.
\begin{equation}
(\lambda + \mu) \frac{d\theta}{dx} + \mu\Delta_2u
\end{equation}
Equation no. 1 \textit{bis} to follow
\begin{equation}
\theta = \frac{du}{dx} + \frac{dv}{dy} + \frac{d\eta}{dz}
\end{equation}
Equation no. 2 to follow.
\begin{equation}
y = mx + b \\[0.5em]
\end{equation}
Equation no. 2 \textit{bis} to follow
\begin{equation}
a^2 + b^2 = c^2
\end{equation}
Equation no. 2 \textit{ter} to follow
\begin{equation}
E = mc^2
\end{equation}
Equation no. 3 to follow
\begin{equation}
e^{\pi i}=-1
\end{equation}
Equation no. 4 to follow
\begin{equation}
\cos^2{x} + \sin^2{x} = 1
\end{equation}
\end{document}
这种语法将第二个方程编号为 (2),然后按升序排列,正如人们所期望的那样。
我也希望能够交叉引用这些方程编号。我该如何实现我想要的输出?
答案1
如果没有 expl3,您可以使用以下方法将整数转换为所需的任何值:
\ifcase#1\or\or bis\or ter\or quater\or quinquies\or
sexies\or septies\or octies\or novies\or decies\fi
通过替换#1
您想要的数字。在这种情况下,我们可以创建一个宏,并\value{equation}
作为参数传递。
无论如何,我不知道前面的阿拉伯数字是如何bis
递增的。所以我创建了一个宏,\latintags
用于组内,保存当前方程计数器并开始使用 bis 等。
\documentclass{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{mathtools,amsthm,amssymb}
\usepackage[frenchb]{babel}
\newcommand*\dif{\mathop{}\!d}
\newcommand*\latinnumeral[1]
{\ifcase#1\unskip\or\unskip\or bis\or ter\or quater\or quinquies\or
sexies\or septies\or octies\or novies\or decies\fi}
\newcommand*\latintags
{\xdef\startingequationnumber{\the\numexpr\value{equation}+1\relax}%
\setcounter{equation}{0}%
\aftergroup\resetarabicequations
\def\theequation
{\startingequationnumber~\textit{\latinnumeral{\value{equation}}}}}
\newcommand*\resetarabicequations
{\setcounter{equation}{\numexpr\startingequationnumber\relax}}
\begin{document}
\latintags
Equation no. \eqref{abc} to follow.
\begin{equation}
(\lambda + \mu) \frac{\dif \theta}{\dif x} + \mu\Delta_2u \label{abc}
\end{equation}
\bigskip
Equation no. \eqref{def} to follow
\begin{equation}
\theta = \frac{\dif u}{\dif x} + \frac{\dif v}{\dif y} + \frac{\dif \eta}{\dif z} \label{def}
\end{equation}
\end{document}
如果(正如我想象的)你希望这种情况只在某个特定的环境中发生,例如,corollary
你可以使用etoolbox
\usepackage{etoolbox}
\AtBeginEnvironment{corollary}{\latintags}
..
\begin{corollary}
Equation no. \eqref{abc} to follow.
\begin{equation}
(\lambda + \mu) \frac{\dif \theta}{\dif x} + \mu\Delta_2u \label{abc}
\end{equation}
\bigskip
Equation no. \eqref{def} to follow
\begin{equation}
\theta = \frac{\dif u}{\dif x} + \frac{\dif v}{\dif y} + \frac{\dif \eta}{\dif z} \label{def}
\end{equation}
\end{corollary}
或者可能不一定在像定理这样的环境中,而只是几个方程,你可以使用环境{latintags}
对它们进行分组:
\begin{equation}
A
\end{equation}
\begin{equation}
A
\end{equation}
\begin{equation}
A
\end{equation}
\begin{latintags}
Equation no. \eqref{abc} to follow.
\begin{equation}
A \label{abc}
\end{equation}
Equation no. \eqref{def} to follow
\begin{equation}
A \label{def}
\end{equation}
Equation no. \eqref{ghi} to follow
\begin{equation}
A \label{ghi}
\end{equation}
Equation no. \eqref{jkl} to follow
\begin{equation}
A \label{jkl}
\end{equation}
Equation no. \eqref{mno} to follow
\begin{equation}
A \label{mno}
\end{equation}
Equation no. \eqref{pqr} to follow
\begin{equation}
A \label{pqr}
\end{equation}
Equation no. \eqref{stu} to follow
\begin{equation}
A \label{stu}
\end{equation}
\end{latintags}
\begin{equation}
A
\end{equation}
\begin{equation}
A
\end{equation}
\begin{equation}
A
\end{equation}
\begin{equation}
A
\end{equation}
答案2
也许下面的一组命令可能是你感兴趣的:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[frenchb]{babel}
\usepackage{mathtools,refcount,xparse}
% http://tex.stackexchange.com/a/254255/5764
\ExplSyntaxOn
\seq_new:N \bislist
\seq_set_split:Nnn \bislist {;} {bis;ter;quater;quinquies;sexies;septies;octies;novies;decies}
\NewDocumentCommand {\bisprint} {m}
{
\seq_item:Nn \bislist {#1}
}
\ExplSyntaxOff
\newcommand{\feqref}[1]{\textup{(\ref{#1}~\textit{\bisprint{\getrefnumber{#1}}})}}
\newcommand{\eqnumfmt}[1]{#1~\textit{\bisprint{\value{equation}}}}
\newtagform{freqnum}[\eqnumfmt]{(}{)}
\usetagform{freqnum}
\newenvironment{frequation}
{\usetagform{freqnum}
\begin{equation}}
{\end{equation}}
\begin{document}
Equation~\feqref{abc} to follow.
\begin{frequation}
(\lambda + \mu) \frac{d\theta}{dx} + \mu\Delta_2u \label{abc}
\end{frequation}
Equation \feqref{def} to follow
\begin{frequation}
\theta = \frac{du}{dx} + \frac{dv}{dy} + \frac{d\eta}{dz} \label{def}
\end{frequation}
\end{document}
frequation
使用新的“标签形式”(使用提供mathtools
) 添加一个“数字字符串”。\freqref
是等效的编号引用,类似于使用\eqref
。