サブセクションに従って方程式に番号を付けますが、番号のないサブセクションは表示しません。

サブセクションに従って方程式に番号を付けますが、番号のないサブセクションは表示しません。

方程式をセクション (サブセクション) に従って番号付けしたいので、参照すると (1.1) のように表示されますが、セクションとサブセクションには番号が表示されないようにする必要があります。そのため、セクションは「1 SECTION」ではなく「SECTION」のようになり、サブセクションは「1.1 SUBSECTION」ではなく「SUBSECTION」のようになる必要があります。これは、番号が表示されず、方程式に希望どおりに番号が付けられない現在のコードです。

\documentclass[pdftex,10pt,a4paper]{article}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]
{geometry}      
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{dcolumn}
\usepackage[english]{babel}
\usepackage{siunitx}
\usepackage{mhchem}

%Command to not display numbers of sections and subsections...
\makeatletter
\renewcommand\thesection{}
\renewcommand\thesubsection{}
\renewcommand\thesubsubsection{}
\makeatother
% command to number equations according to the their sections
\numberwithin{equation}{section}

\begin{document}

\section{Introduction}
\subsubsection{Theoretical principles}
here comes some text and the first reference \eqref{eq:lnpp0} the text goes on
then the first eqation is implemented.

\begin{equation}\label{eq:lnpp0}
\mathrm{ln} \dfrac{p}{p_0} \, = \, \dfrac{\Delta_\mathrm{v}H}{R}\left( \dfrac{1}{T_0}-\dfrac{1}{T}\right) 
\end{equation}

Rearranging the equation the formula gives you $\Delta_\mathrm{v}H$ 
for the enthalpy of vaporization which can be used to 
determine the entropy of vaporization:

\begin{equation}\label{eq:deltaS}
\Delta_\mathrm{v}S\,=\, \dfrac{\Delta_\mathrm{v}H}{T}
\end{equation}

\section{The second section}

This is the equation i want to reference to \eqref{eq:lnpp0}

\end{document}

このコードは、セクションとサブセクションの番号を(希望どおりに)表示しませんが、方程式に適切な番号を付けず、(1.1)ではなく(.1)と番号付けします。

追伸:これは私の最初の質問なので、私の「質問スタイル」をさらに改善するためのコメントをいただければ嬉しいです。

答え1

etcを何も定義しないで再定義しないでくださいthesection。ただし、セクションレベルを次のように再定義してください。titlesec

\usepackage{titlesec}
\titleformat{\section}
{\normalfont\Large\bfseries}{}{0em}{}
\titleformat{\subsection}
{\normalfont\large\bfseries}{}{0em}{}
\titleformat{\subsubsection}
{\normalfont\normalsize\bfseries}{}{0em}{}
\titleformat{\paragraph}[runin]
{\normalfont\normalsize\bfseries}{}{0em}{}
\titleformat{\subparagraph}[runin]
{\normalfont\normalsize\bfseries}{}{0em}{}

レベルごとに数字が表示されないように、すべてのレベルを参考用に再定義しました。

これを前文にすると

ここに画像の説明を入力してください

しかし、これでは読者を混乱させる可能性があります。

完全なコード:

\documentclass[10pt,a4paper]{article}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]
{geometry}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{dcolumn}
\usepackage[english]{babel}
\usepackage{siunitx}
\usepackage{mhchem}

%Command to not display numbers of sections and subsections...
\usepackage{titlesec}
\titleformat{\section}
{\normalfont\Large\bfseries}{}{0em}{}
\titleformat{\subsection}
{\normalfont\large\bfseries}{}{0em}{}
\titleformat{\subsubsection}
{\normalfont\normalsize\bfseries}{}{0em}{}
\titleformat{\paragraph}[runin]
{\normalfont\normalsize\bfseries}{}{0em}{}
\titleformat{\subparagraph}[runin]
{\normalfont\normalsize\bfseries}{}{0em}{}
% command to number equations according to the their sections
\numberwithin{equation}{section}


\begin{document}

\section{Introduction}
\subsubsection{Theoretical principles}
here comes some text and the first reference \eqref{eq:lnpp0} the text goes on
then the first eqation is implemented.

\begin{equation}\label{eq:lnpp0}
\mathrm{ln} \dfrac{p}{p_0} \, = \, \dfrac{\Delta_\mathrm{v}H}{R}\left( \dfrac{1}{T_0}-\dfrac{1}{T}\right)
\end{equation}

Rearranging the equation the formula gives you $\Delta_\mathrm{v}H$
for the enthalpy of vaporization which can be used to
determine the entropy of vaporization:

\begin{equation}\label{eq:deltaS}
\Delta_\mathrm{v}S\,=\, \dfrac{\Delta_\mathrm{v}H}{T}
\end{equation}

\section{The second section}

This is the equation i want to reference to \eqref{eq:lnpp0}

\end{document}

答え2

追加のパッケージは必要ありません。セクション番号の印刷は内部コマンドによって実行されます\@seccntformat。何もしないように再定義すると、番号は表示されません。

\documentclass[10pt,a4paper]{article}

\usepackage{amsmath}

%Command to not display numbers of sections and subsections...
\makeatletter
\renewcommand{\@seccntformat}[1]{}
\makeatother
% command to number equations according to the their sections
\numberwithin{equation}{section}

\begin{document}

\section{Introduction}
\subsubsection{Theoretical principles}
here comes some text and the first reference \eqref{eq:lnpp0} the text goes on
then the first equation is implemented.
\begin{equation}\label{eq:lnpp0}
\ln\frac{p}{p_0} =\frac{\Delta_{\mathrm{v}}H}{R}\left( \frac{1}{T_0}-\frac{1}{T}\right)
\end{equation}
Rearranging the equation the formula gives you $\Delta_\mathrm{v}H$
for the enthalpy of vaporization which can be used to
determine the entropy of vaporization:
\begin{equation}\label{eq:deltaS}
\Delta_{\mathrm{v}}S=\frac{\Delta_{\mathrm{v}}H}{T}
\end{equation}

\section{The second section}

This is the equation I want to reference to \eqref{eq:lnpp0}

\end{document}

amsmath他のパッケージはこの例では必要ないので、だけを残しました(ただし、もちろんドキュメントに追加することもできます)。

注意すべき点がいくつかあります。

  1. \mathrm{ln}は間違っており、そうあるべきです\ln

  2. 下付き文字を中括弧で囲みます: \Delta_{\mathrm{v}}.

  3. このコマンドが\dfrac必要になることはめったにありません\frac。小さく印刷される場所で大きなバージョンが本当に必要な場合を除いて、このコマンドを使用することをお勧めします。

  4. の前には絶対に空行を入れないでくださいequation。 の後のテキストが新しい段落である場合は、 の後に空行を入れることができます。

  5. このpdftexオプションは絶対に使用しないでください。一般的に使用されない少数のパッケージでのみ必要です。

ここに画像の説明を入力してください

関連情報