定理のタイトルは外側の余白に書く(偶数ページ / 奇数ページ)

定理のタイトルは外側の余白に書く(偶数ページ / 奇数ページ)

定理/定義/その他のラベルを外側のページ余白(偶数ページと奇数ページを考慮)。まず、パッケージ(コードと画像は下記)を使用しようとしました。しかし、ラベルを常に左余白に配置することしかできませんでした。特に、と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}

関連情報