하위 섹션에 따라 숫자 방정식을 표시하지만 숫자가 없는 하위 섹션은 표시하지 않습니다.

하위 섹션에 따라 숫자 방정식을 표시하지만 숫자가 없는 하위 섹션은 표시하지 않습니다.

(하위)섹션에 따라 방정식에 번호를 매기고 싶기 때문에 참조할 때 예를 들어 (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

thesectionetc를 아무것도 아닌 것으로 재정의해서는 안됩니다 . 그러나 다음을 사용하여 단면 수준을 재정의합니다.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. 일반적으로 사용되지 않는 몇 가지 패키지에만 이 옵션이 필요합니다.

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

관련 정보