如何在定義末尾加上“qed square”?

如何在定義末尾加上“qed square”?

我正在使用acmart文檔類別來提交會議論文。我提供了一個簡單的範例(下面的程式碼),目前呈現以下輸出:

在此輸入影像描述

問題:

  1. 如何更改“定義”環境,使文字“定義”看起來與文字“定理”相同(刪除斜體並且字體似乎也不同)?
  2. 如何加入一個新的「備註」環境,使其顯示與已存在的環境(定理、引理、推論…)相同的內容?
  3. 如何在這些環境的末端添加相同大小的「qed 方塊」(即使它們沒有「證明」)?

代碼:

\documentclass[acmtog,anonymous,review]{acmart}
\usepackage{graphicx}

\AtEndPreamble{%
\theoremstyle{acmtheorem}
\newtheorem{remark}[theorem]{Remark}}

\begin{document}

\section{}

\begin{theorem}
    A theorem.
    \begin{proof}
    \end{proof}
\end{theorem}

\begin{definition}
    A definition.
    \begin{flushright}
        $\square$
    \end{flushright}
\end{definition}

\begin{remark}
    A remark.
    \begin{flushright}
        $\square$
    \end{flushright}
\end{remark}

\end{document}

答案1

如果您要向會議提交內容,則不應嘗試修改他們的標準。不管怎樣,你可以這樣做。

\documentclass[acmtog,anonymous,review]{acmart}

\AtEndPreamble{%
  \theoremstyle{acmplain}%
  % note to copy editors: remove the following
  % two lines if standard ACM style is preferred
  \let\definition\relax\let\enddefinition\relax
  \newtheorem{definition}[theorem]{Definition}%
  % end note to copy editors
  \newtheorem{remark}[theorem]{Remark}%
  \AtBeginEnvironment{definition}{\pushQED{\qed}}%
  \AtEndEnvironment{definition}{\popQED}%
  \AtBeginEnvironment{remark}{\pushQED{\qed}}%
  \AtEndEnvironment{remark}{\popQED}%
}

\begin{document}

\section{Test}

\begin{theorem}
A theorem.
\end{theorem}
\begin{proof}
And its proof.
\end{proof}

\begin{definition}
A definition.
\end{definition}

\begin{remark}
A remark.
\end{remark}

\end{document}

在此輸入影像描述

筆記。

  1. 標準定理樣式是acmplain.
  2. 證明不屬於定理。

答案2

我理解你的問題意味著你想要定理、定義和評論全部具有相同的風格。既然如此,我就按順序回答你的問題:

  1. 如何加入一個新的「備註」環境,使其顯示與已存在的環境(定理、引理、推論…)相同的內容?

編輯:根據您的評論,我相信您希望所有三個環境的標題​​都採用小型大寫字母,正文採用非斜體字體。

首先,您需要定義一個新的定理樣式,因為acmart這兩個預先定義的定理樣式都不適合您的需求。這acmart類別文檔提供定理樣式定義的原始程式碼acmplain(我相信在第 110 頁),因此您可以將該定義複製並貼上到您自己的程式碼中,並根據需要進行修改。然後您可以用來\theoremstyle{your-style-name}設定自訂定理環境的樣式。

  1. 如何更改“定義”環境,使文字“定義”看起來與文字“定理”相同(刪除斜體並且字體似乎也不同)?

由於沒有直接的方法來修改定理環境的定義,因此您必須自己定義definition(and theorem) 的樣式。您有兩個選擇:

  1. 使用不同的名稱定義您自己的定義和定理環境,以便它們不會與現有環境發生衝突。我推薦此選項,因為它是最簡單的,並且不會覆蓋現有定義(以防可能導致您的提交出現問題)。
  2. 使用 class 選項抑制現有的環境定義acmthm=false。然後,您可以定義自己的definition環境,theorem而不會與任何現有環境發生衝突。請注意,這會抑制由定義的所有定理環境acmart,包括theorempropositiondefinitionexample等。
  1. 如何在這些環境的末端添加相同大小的「qed 方塊」(即使它們沒有「證明」)?

我建議使用該thmtools套件進行自訂環境定義,因為這使得設定 QED 符號變得非常容易。該解決方案建議於貼文由@barbara-beeton 在評論中鏈接,但這是第三個。請參閱thmtools包文件更多細節。

新的和改進的 MWE(具有不同名稱的自訂環境):

\documentclass[acmtog, anonymous, review]{acmart}

\usepackage{thmtools}

\makeatletter
\AtEndPreamble{
    % Modified from definition of acmplain
    % acmart documentation, page 110
    % https://mirror.las.iastate.edu/tex-archive/macros/latex/contrib/acmart/acmart.pdf
    \newtheoremstyle{mystyle}%
        {.5\baselineskip\@plus.2\baselineskip
            \@minus.2\baselineskip}% space above
        {.5\baselineskip\@plus.2\baselineskip
            \@minus.2\baselineskip}% space below
        {\normalfont}% body font
        {\@acmplainindent}% indent amount
        {\scshape}% head font
        {.}% punctuation after head
        {.5em}% spacing after head
        {\thmname{#1}\thmnumber{ #2}\thmnote{ {\@acmplainnotefont(#3)}}}% head spec

    \theoremstyle{mystyle}
    \declaretheorem[name=Theorem, parent=section]{thm}
    \declaretheorem[name=Definition, qed=$\square$, sibling=thm]{defn}
    \declaretheorem[name=Remark, qed=$\square$, sibling=thm]{remark}
}
\makeatother

\begin{document}

\section{}

\begin{thm}
    A theorem.
    \begin{proof}
    \end{proof}
\end{thm}

\begin{defn}
    A definition.
\end{defn}

\begin{remark}
    A remark.
\end{remark}

\end{document}

OP 的 MWE 具有所需的樣式和 QED 符號

相關內容