
方程式にラベルを付けたい
\[ 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}
。left
は、right
タグの左側と右側に記述する内容です (通常は括弧)。 は、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}
そして、あなたが望むものを提供します...(私はそう願っています)...あなたが持っている他の方程式の自動番号付けについては、私が参照した質問と回答のいずれかを使用できます(この質問もそれを始めました...)