外頁邊距中的定理標題(偶數/奇數頁)

外頁邊距中的定理標題(偶數/奇數頁)

我希望定理/定義/等標籤出現在頁邊距(考慮偶數頁和奇數頁)。首先,我嘗試使用該thmtools包(下面的程式碼和圖像)。然而,我只能設法將標籤始終放置在左邊距中。特別是,我不知道如何thmtoolsifoddpage.

接下來,我嘗試了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}

相關內容