
나는 같은 줄에 두 방정식의 작은 세트를 갖고 싶습니다. 각 방정식에는 레이블이 붙어 있고 두 레이블은 모두 맨 오른쪽에 있습니다. 코드는 다음과 같습니다.
\documentclass{article}
\usepackage{amsmath}
\begin{document}
We have
\begin{equation}
a = b \label{eqab} \quad \text{and} \quad c = d \label{eqcd}
\end{equation}
and equations \ref{eqab} and \ref{eqcd} are nice.
\end{document}
(소스 줄 내의 레이블 위치는 중요하지 않습니다.) 다음과 같이 나타납니다.
We have\vspace{3ex}
\hfill $a=b \quad \text{and} \quad c=d$ \hfill (1) and (2)\vspace{3ex}
and equations (1) and (2) are nice.
그러나 \label
같은 줄에 두 개를 넣으면 `Package amsmath Error:
Multiple \label...` (the same for `\tag`).
답변1
아마도 당신은 다음과 같은 것을 찾고 있을 것입니다:
\documentclass{article}
\usepackage{amsmath}
\usepackage[a4paper,showframe]{geometry}
\begin{document}
We have:
\noindent\begin{minipage}{0.4\textwidth}
\begin{equation}
a = b \label{eqab}
\end{equation}
\end{minipage}%
\begin{minipage}{0.2\textwidth}\centering
and
\end{minipage}%
\begin{minipage}{0.4\textwidth}
\begin{equation}
c = d \label{eqcd}
\end{equation}
\end{minipage}\vskip1em
Equations \ref{eqab} and \ref{eqcd} are nice. The same is valid for the next two:
\begin{subequations}\label{eq:3}
\noindent\begin{minipage}{0.4\textwidth}
\begin{equation}
a = b \label{eq:3a}
\end{equation}
\end{minipage}%
\begin{minipage}{0.2\textwidth}\centering
and
\end{minipage}%
\begin{minipage}{0.4\textwidth}
\begin{equation}
c = d \label{eq:3b}
\end{equation}
\end{minipage}\vskip1em
\end{subequations}
which are \ref{eq:3a} and \ref{eq:3b}.
\end{document}
답변2
\documentclass{article}
\usepackage{amsmath,tabularx}
\begin{document}
We have
\noindent
\begin{tabularx}{\linewidth}{XXX}
\begin{equation}
a = b \label{eqab}
\end{equation}
& \[ \text{and} \] &
\begin{equation}
c = d \label{eqcd}
\end{equation}
\end{tabularx}
and equations \ref{eqab} and \ref{eqcd} are nice.
\end{document}
답변3
\label
이는 방정식 번호를 생성하는 것이 아니기 때문에 예상되는 것입니다 .
같은 줄에 두 개의 번호가 매겨진 방정식을 정말로 원하지만 권장하지 않는 경우 미니페이지를 사용할 수 있습니다.
\documentclass{article}
\usepackage{amsmath}
\begin{document}
We have
\begin{center}
\begin{minipage}[b]{.3\textwidth}
\vspace{-\baselineskip}
\begin{equation}
a = b \label{eqab}
\end{equation}
\end{minipage}%
\hfill\hfill and\hfill
\begin{minipage}[b]{.3\textwidth}
\vspace{-\baselineskip}
\begin{equation}
c = d \label{eqcd}
\end{equation}
\end{minipage}
\end{center}
and equations \ref{eqab} and \ref{eqcd} are nice.
\end{document}
답변4
\label
Amsmath는 방정식에서 둘 이상의 매크로를 구체적으로 금지할 수 있지만 이것이 동일한 작업을 수행하기 위해 다른 매크로를 만들 수 없다는 의미는 아닙니다. 참고: 이 버전은 hyperref와 호환되지 않습니다.
\documentclass{report}
\usepackage{amsmath}
\makeatletter
\newcommand{\steplabel}[1]% #1 = label name
{\refstepcounter{equation}%
\protected@write\@auxout{}{\string\newlabel{#1}{{\theequation}{\thepage}}}}
\makeatother
\begin{document}
We have
\begin{equation}
a=b \quad \text{and} \quad c=d
\tag*{\steplabel{eqab}(\theequation) and \steplabel{eqcd}(\theequation)}
\end{equation}
and equations \eqref{eqab} and \eqref{eqcd} are nice.
\end{document}