![外頁邊距中的定理標題(偶數/奇數頁)](https://rvso.com/image/391714/%E5%A4%96%E9%A0%81%E9%82%8A%E8%B7%9D%E4%B8%AD%E7%9A%84%E5%AE%9A%E7%90%86%E6%A8%99%E9%A1%8C%EF%BC%88%E5%81%B6%E6%95%B8%2F%E5%A5%87%E6%95%B8%E9%A0%81%EF%BC%89.png)
我希望定理/定義/等標籤出現在外頁邊距(考慮偶數頁和奇數頁)。首先,我嘗試使用該thmtools
包(下面的程式碼和圖像)。然而,我只能設法將標籤始終放置在左邊距中。特別是,我不知道如何thmtools
與ifoddpage
.
接下來,我嘗試了ntheorem
(下面的程式碼和圖像)。使用 時ntheorem
,標籤放置可以正常工作,但我無法更改定理標題的字體樣式(下圖中的“一些重要定理”)並將其放置在自己的一行上。此外,我無法擺脫縮排。最後,它也破壞了我的autoref
參考資料。
到總結:我正在尋找的是一個允許的定理環境
- 標籤在外頁邊距(奇數頁/偶數頁)
- 標籤、標題和正文的完整樣式控制
autoref
相容性(特別是,我想對不同的定理環境(例如定理、定義等)使用單一計數器)
我快要放棄了,所以我真的希望有人能幫助我。
代碼thmtools
:
\documentclass[10pt, a4paper, twoside]{article}
\usepackage[a4paper, inner=1.25in, outer=1.25in]{geometry}
\usepackage{color}
\usepackage{amsthm}
\usepackage{thmtools}
\newlength{\spaceblength}
\settowidth{\spaceblength}{\bfseries\ }
\declaretheoremstyle[
headfont=\bfseries,
notefont=\bfseries,
notebraces={}{\\[\parskip]}, % Braces for additional text
bodyfont=\normalfont\itshape,
headpunct={},
headformat={%
\makebox[0pt][r]{\color{red}\NAME\ \NUMBER\ \ }\hskip-\spaceblength{\NOTE}%
}
]{boxstyle}
\declaretheorem[style=boxstyle,numberwithin=section]{theorem}
\begin{document}
\begin{theorem}[Some Important Theorem]
This is a theorem. This is a theorem. This is a theorem. This is a theorem. This is a theorem.
This is a theorem. This is a theorem. This is a theorem. This is a theorem. This is a theorem.
This is a theorem. This is a theorem. This is a theorem. This is a theorem. This is a theorem.
This is a theorem. This is a theorem. This is a theorem. This is a theorem. This is a theorem.
\end{theorem}
\newpage
\begin{theorem}[Some Important Theorem]
This is a theorem. This is a theorem. This is a theorem. This is a theorem. This is a theorem.
This is a theorem. This is a theorem. This is a theorem. This is a theorem. This is a theorem.
This is a theorem. This is a theorem. This is a theorem. This is a theorem. This is a theorem.
This is a theorem. This is a theorem. This is a theorem. This is a theorem. This is a theorem.
\end{theorem}
\end{document}
代碼ntheorem
:
\documentclass[10pt, a4paper, twoside]{article}
\usepackage[a4paper, inner=1.25in, outer=1.25in]{geometry}
\usepackage{color}
\usepackage{ifoddpage}
\usepackage{ntheorem}
\makeatletter%
\newtheoremstyle{nonumoutermargin}%
{\item[\checkoddpage\ifoddpageoroneside\rlap{\hskip\linewidth\theorem@headerfont {\hskip18pt##1}}%
\else\llap{\theorem@headerfont{##1}\hskip6pt}\fi]}%
{\item[\checkoddpage\ifoddpageoroneside\rlap{\hskip\linewidth\theorem@headerfont {\hskip18pt##1}}%
\else\llap{\theorem@headerfont{##1}\hskip6pt}\fi##3]}
\newtheoremstyle{outermargin}%
{\item[\checkoddpage\ifoddpageoroneside\rlap{\hskip\linewidth\theorem@headerfont {\hskip18pt##1\hskip\labelsep##2}}%
\else\llap{\theorem@headerfont{##1\hskip\labelsep##2}\hskip6pt}\fi]}%
{\item[\checkoddpage\ifoddpageoroneside\rlap{\hskip\linewidth\theorem@headerfont{\hskip18pt##1\hskip\labelsep##2}}%
\else\llap{\theorem@headerfont{##1\hskip\labelsep##2}\hskip6pt}\fi##3]}
\makeatother
\theoremindent=0pt
\theoremheaderfont{\upshape\bfseries\color{red}}
\theoremstyle{outermargin}
\newtheorem{theorem}{Theorem}[section]
\begin{document}
\begin{theorem}[Some Important Theorem]
This is a theorem. This is a theorem. This is a theorem. This is a theorem. This is a theorem.
This is a theorem. This is a theorem. This is a theorem. This is a theorem. This is a theorem.
This is a theorem. This is a theorem. This is a theorem. This is a theorem. This is a theorem.
This is a theorem. This is a theorem. This is a theorem. This is a theorem. This is a theorem.
\end{theorem}
\newpage
\begin{theorem}[Some Important Theorem]
This is a theorem. This is a theorem. This is a theorem. This is a theorem. This is a theorem.
This is a theorem. This is a theorem. This is a theorem. This is a theorem. This is a theorem.
This is a theorem. This is a theorem. This is a theorem. This is a theorem. This is a theorem.
This is a theorem. This is a theorem. This is a theorem. This is a theorem. This is a theorem.
\end{theorem}
\end{document}
答案1
我繼續尋找答案,以下內容對我有用(我以為我之前已經嘗試過,但它沒有編譯...):
\documentclass[10pt, a4paper, twoside]{article}
\usepackage[a4paper, inner=1.25in, outer=1.25in]{geometry}
\usepackage{color}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage{ifoddpage}
\newlength{\spaceblength}
\settowidth{\spaceblength}{\bfseries\ }
\declaretheoremstyle[
headfont=\bfseries,
notefont=\bfseries,
notebraces={}{\\[\parskip]}, % Braces for additional text
bodyfont=\normalfont\itshape,
headpunct={},
headformat={%
\checkoddpage\ifoddpage\rlap{\hskip\textwidth\color{red}\ \ \ \NAME\ \NUMBER}\hskip-\spaceblength{\NOTE}%
\else\makebox[0pt][r]{\color{red}\NAME\ \NUMBER\ \ \ }\hskip-\spaceblength{\NOTE}\fi%
},
]{boxstyle}
\declaretheorem[style=boxstyle,numberwithin=section]{theorem}
\begin{document}
\begin{theorem}[Some Important Theorem]
This is a theorem. This is a theorem. This is a theorem. This is a theorem. This is a theorem.
This is a theorem. This is a theorem. This is a theorem. This is a theorem. This is a theorem.
This is a theorem. This is a theorem. This is a theorem. This is a theorem. This is a theorem.
This is a theorem. This is a theorem. This is a theorem. This is a theorem. This is a theorem.
\end{theorem}
\newpage
\begin{theorem}[Some Important Theorem]
This is a theorem. This is a theorem. This is a theorem. This is a theorem. This is a theorem.
This is a theorem. This is a theorem. This is a theorem. This is a theorem. This is a theorem.
This is a theorem. This is a theorem. This is a theorem. This is a theorem. This is a theorem.
This is a theorem. This is a theorem. This is a theorem. This is a theorem. This is a theorem.
\end{theorem}
\end{document}