사용자 정의 방정식 번호 매기기

사용자 정의 방정식 번호 매기기

방정식에 라벨을 붙이고 싶습니다.

\[ 1 + 2 + \cdots + i = \frac{i(i+1)}{2} \eqname{Inequality(i)} \label{ineq} \]

변수 "i"를 (i)의 함수로 포함하므로 예상되는 출력은 다음과 같습니다.

[위 방정식의 LaTeX 렌더링] (2.4)(i)

(실제로 "i"와 같은 방정식이 있음을 의미합니다). (2.4)는 섹션 2의 방정식 4를 참조할 수 있습니다. 나중에 방정식에 액세스하면 다음과 같이 나타나기를 원합니다.

식 (2.4)(n+1)은 식 (2.4)(n)에서 나오므로 유도를 이용하면...

(편집: 댓글의 질문을 명확하게 하기 위해 문구를 개선했습니다.)

답변1

당신이 얻고자 하는 것이 무엇인지 제가 정확하게 추측했는지 살펴보겠습니다.

다음 코드의 출력

이 출력은 다음 코드에 의해 생성되었습니다.

% My standard header for TeX.SX answers:
\documentclass[a4paper]{article} % To avoid confusion, let us explicitly 
                                 % declare the paper format.

\usepackage[T1]{fontenc}         % Not always necessary, but recommended.
% End of standard header.  What follows pertains to the problem at hand.

\usepackage{amsmath}

\numberwithin{equation}{section}

\newcommand*{\myTagFormat}[2]{(\ref{#1})($#2$)}



\begin{document}

\section{First}

Just to include a couple of equations:
\begin{align}
      1 &= 1 \label{eq:one} \\
    1+2 &= 3 \label{eq:two}
\end{align}
Until now, we have equations \eqref{eq:one} and~\eqref{eq:two}.

\section{Second}

Still another equation of the same form:
\begin{equation}
    1+2+3 = 6 \label{eq:three}
\end{equation}
Generalizing equations \eqref{eq:one}, \eqref{eq:two}, and~\eqref{eq:three}, we 
claim that
% Little trick:
\refstepcounter{equation}\label{eq:base}% <-- Note!
\begin{equation}
    1+2+\dots+n = \frac{n(n+1)}{2}
    \tag*{\myTagFormat{eq:base}{n}}\label{eq:base-n}
\end{equation}
Now you can either:
\begin{itemize}
    \item
        reference equation~\ref{eq:base-n} directly (note that you must use
        \verb|\ref| instead of \verb|\eqref|, here), or
    \item
        say that equation~\myTagFormat{eq:base}{i+1} follows from
        equation~\myTagFormat{eq:base}{i} by adding $i+1$ on both sides of the
        latter.
\end{itemize}
One more equation to check that we haven't spoiled the numbering:
\begin{equation}
    x=y
\end{equation}

\end{document}

답변2

여기에 이미지 설명을 입력하세요

mathtools패키지 명령을 사용하면 \newtagform매우 상세한 방식으로 방정식 번호 매기기를 사용자 정의할 수 있습니다. 명령의 일반 구문은 다음과 같습니다.

\newtagform{label}[tag format]{left}{right}

label명령을 사용하여 검색할 수 있는 태그 지정 방법의 고유 ID이며 \usetagform{label}태그 의 왼쪽 leftright오른쪽(일반적으로 대괄호)에 기록되어야 합니다. tag format원하는 태깅의 세부정보입니다 . 특별한 경우에는 다음 구문을 사용할 수 있습니다.

[\renewcommand{\theequation}{(\arabic{chapter}.\arabic{section})(\roman{equation})}]

새로운 번호 매기기 형식을 설정한 후에는 방정식을 참조할 때 방정식이 표시되는 방식도 변경해야 합니다. 원하는 스타일에 대한 코드는 다음과 같아야 합니다.

\renewcommand{\theequation}{(\arabic{chapter}.\arabic{section})(\roman{equation})}

다음은 이 사용자 정의 번호 매기기 작동 방식의 예입니다.

\documentclass[]{report}
\usepackage{amsmath}
\usepackage{amssymb, amsfonts}
\usepackage{gensymb}
\usepackage{mathtools}
    \newtagform{Alph}[\renewcommand{\theequation}{(\arabic{chapter}.\arabic{section})(\roman{equation})}]{}{}
    \usetagform{Alph}
\renewcommand{\theequation}{(\arabic{chapter}.\arabic{section})(\roman{equation})}


\begin{document}


\chapter{First Chapter}

\section{First Section}
\label{sec:one}

\begin{equation}
I = I_{ ph } -  
\overbrace{
    I_{ rs }
    \biggl[
    exp \biggl(
    \frac{V + I R_{s}}{a \thinspace V_{t}}
    \biggl) - 1   
    \biggl]
    % overbrace title
}^{ I_{d} }
-
\overbrace{
    \frac{V + I R_{s}}{R_{p}}
    % overbrace title
}^{I_{p}}
%
\label{eq:I_PV_m}
\end{equation}

\begin{equation}
\label{eq:R_p}
%
R_{p} = R_{p,ref}  \biggl(   \frac{G_{ref}}{G_{op}}  \biggl)   \biggl(  \frac{T_{op}}{T_{ref}}  \biggl)^{\delta_{p}}
\end{equation}


\begin{equation}
PMARE = \underset{i}{max} 
\biggl|  \frac{x_{i}-y_{i}}{y_{i}}  \biggl| \times 100\%
\quad i = 1, 2, \cdots , n
%
\label{eq:PMPARE}
\end{equation}


     A test for referencing Eqs. \ref{eq:I_PV_m}, \ref{eq:R_p}, and \ref{eq:PMPARE} which belong to Section \ref{sec:one}.


\section{Second Section}
\label{sec:two}

\begin{equation}
\label{eq:R_{s}}
%
R_{s} = R_{s,ref}  \biggl(   \frac{T_{op}}{T_{ref}} \biggl)^{\delta_{s}}
\end{equation}


\begin{align}
I_{ph} &= I_{sc} \frac{R_{s} + R_{p}}{R_{p}}  \notag
\\
&= I_{sc,ref} \bigg[  1 + \frac{\alpha}{100} (T_{op}-T_{ref}) \biggl]
\frac{G_{op}}{G_{ref}} \frac{R_{s} + R_{p}}{R_{p}}
%
\label{eq:I_ph}
\end{align}


    A test for referencing Eqs. \ref{eq:R_{s}} and \ref{eq:I_ph}which belong to Section \ref{sec:two}.


\end{document}

다른 종류의 번호 매기기 옵션에는 \Roman(대문자 로마자) \alph및 가 포함됩니다 \Alph. 행운을 빌어요

답변3

나는 처음 읽을 때 질문을 잘 이해하지 못했고 당신이 다음과 같은 것을 원한다고 생각했습니다.이것.

하지만 내 대답은 (n+1)과 같은 결과를 제공할 수 없기 때문에 정확히 원하는 것이 아닙니다. 하지만 조금 변경하면 다음과 같은 결과를 얻을 수 있습니다.

\makeatletter
\newcommand*\ifcounter[1]{%
  \ifcsname c@#1\endcsname%
    \expandafter\@firstoftwo%
  \else%
    \expandafter\@secondoftwo%
  \fi%
}%
\makeatother


\makeatletter
\newcommand\EqFamCustomTag[2]{%
\ifcounter{#1}{%
\expandafter\addtocounter{#1}{1}%
\xdef\temp{\csname #1 Eq\endcsname \space(#2)}%
\global\expandafter\let\csname #1\arabic{#1}\endcsname\temp%
\tag{\temp}%
}{%
\global\expandafter\newcounter{#1}%
\expandafter\addtocounter{#1}{1}%
\xdef\temp{\theequation\space(#2)}%
\xdef\eqonfamily{\theequation}%
\global\expandafter\let\csname #1 Eq\endcsname\eqonfamily%
\global\expandafter\let\csname #1\arabic{#1}\endcsname\temp%
\tag{\temp}%
\expandafter\addtocounter{equation}{1}
}%
}%
\makeatother

이는 다음과 같이 사용될 수 있습니다:

\begin{equation}
 \frac{x^2}{2}+\frac{3\cdot y^2}{10}=2\EqFamCustomTag{Elliptic}{n+1}
\end{equation}

그리고 당신이 원하는 것을 제공하십시오 ... (희망합니다) ... 당신이 가지고있는 다른 방정식의 자동 번호 매기기를 위해 내가 언급 한 질문 답변 중 하나를 사용할 수 있습니다 (이 질문도 시작되었습니다 ...)

관련 정보