定義 \footnote 的替代方案來調整佈局

定義 \footnote 的替代方案來調整佈局

這是一個後續問題註腳編號與定理標題的距離

我在定義我的\thfootnote.問題涉及\footnote命令的可選參數,如您在 MEW 中看到的那樣

在此輸入影像描述

\documentclass{article}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amsfonts}
\newtheorem{theorem}{Theorem}
\newcommand{\thfootnote}[2][]{\hspace{-0.4em}\footnote[#1]{#2}\hspace{0.3em}}
\begin{document}
\section{Something}
\begin{theorem}[Something]\footnote{Something}
Blah blah.
\end{theorem}
\begin{theorem}[Something]\thfootnote{Something}
Blah blah.
\end{theorem}
\end{document}

答案1

根據你的評論,我相信這就是你想要的:

\documentclass{article}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{etoolbox}

\newtheorem{theorem}{Theorem}

\newcommand{\thfootnote}[2][]{%
  \hspace{-0.4em}%
  \ifstrempty{#1}{\footnote}{\footnote[#1]}%
  {#2}\hspace{0.3em}}

\begin{document}

\section{Something}

\begin{theorem}[Something]\footnote{Something}
Blah blah.
\end{theorem}

\begin{theorem}[Something]\thfootnote{Something}
Blah blah.
\end{theorem}

\end{document}

螢幕截圖

(沒有必要{#2}在兩個選項中都包含 the,因為 TeX 是一種巨集語言 — 它可以不過,納入其中不會造成任何損害。

如果您想要容忍 的可選參數內有空格\thfootnote(將空白可選參數視為空參數),只需替換\ifstrempty\ifblank

答案2

我不確定 的目的\thfootnote是什麼,但是如果您想去掉\hspace{-0.4em}定理中每個腳註之前的空格,則可以只用一個參數來定義新的腳註。然後將其與其他腳註的編號掛鉤。參見 MWE。如果目的不同,請詳細說明您的問題。

如果您需要多個腳註系列,您應該看看大腳或者多足。另外,請注意,標準文章類不會將腳註放置在頁面底部,而是與文字保持固定距離。因此,您應該考慮使用選項來載入 footmisc bottom,或使用其中之一KOMA腳本類。

在此輸入影像描述

\documentclass{article}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amsfonts}
\newtheorem{theorem}{Theorem}
\newcommand{\thfootnote}[1]{\hspace{-0.4em}\footnote{#1}\hspace{0.3em}}
\begin{document}
\section{Something}
\begin{theorem}[Something]\footnote{Something}
Blah blah.
\end{theorem}
\begin{theorem}[Something]\thfootnote{Something}
Blah blah.
\end{theorem}

\begin{theorem}[\footnote{Something}]
Blah blah.
\end{theorem}

\end{document}

相關內容