
amsmath 환경에서 자동 방정식 번호를 강제로 적용할 수 있습니까 equation*
? 같은 것
\begin{equation*} \dotag
x^2
\end{equation*}
의 효과는 로 변환 \dotag
되는 것 입니까 ?equation*
equation
나는 보았다amsmath.sty
\renewenvironment{equation}{%
\incr@eqnum
\mathdisplay@push
\st@rredfalse \global\@eqnswtrue
\mathdisplay{equation}%
}{%
\endmathdisplay{equation}%
\mathdisplay@pop
\ignorespacesafterend
}
\newenvironment{equation*}{%
\mathdisplay@push
\st@rredtrue \global\@eqnswfalse
\mathdisplay{equation*}%
}{%
\endmathdisplay{equation*}%
\mathdisplay@pop
\ignorespacesafterend
}
별표가 없는 버전과 별표가 있는 버전의 차이점은 추가 명령이라는 것을 확인했지만 \incr@eqnum
이 코드를 equation*
내 문서의 환경에 추가하면 작동하지 않습니다.
배경: Pandoc의 마크다운에 표시 수학을 포함하는 가장 좋은 방법은 이를 $$
. LaTeX 출력의 경우 \[
및 로 변환되며 \]
기본 amsmath
템플릿에 포함되어 있으므로 equation*
환경처럼 작동합니다. 해결 방법이 있지만 이 방법에는 몇 가지 장점이 있습니다.
답변1
이건 어때? 나는 \incr@eqnum
당신이 제안한 대로 를 사용하지만 를 통해 방정식 번호도 추가합니다 \tag
.
\documentclass{article}
\usepackage{amsmath}
\makeatletter
\newcommand\dotag{\incr@eqnum\tag{\number\value{equation}}}
\makeatother
\begin{document}
\begin{equation*} \dotag
x^2
\end{equation*}
\begin{equation}
y^2
\end{equation}
\begin{equation*} \dotag
z^2
\end{equation*}
\end{document}
아니면 환경의 정의를 갱신하세요 equation*
.
\documentclass{article}
\usepackage{amsmath}
\makeatletter
\renewenvironment{equation*}{%
\incr@eqnum
\mathdisplay@push
\st@rredfalse \global\@eqnswtrue
\mathdisplay{equation}%
}{%
\endmathdisplay{equation}%
\mathdisplay@pop
\ignorespacesafterend
}
\makeatother
\begin{document}
\begin{equation*}
x^2
\end{equation*}
\begin{equation}
y^2
\end{equation}
\begin{equation*}
z^2
\end{equation*}
\end{document}