Títulos de teoremas nas margens externas (páginas pares/ímpares)

Títulos de teoremas nas margens externas (páginas pares/ímpares)

Gostaria que os rótulos de teorema/definição/etc. aparecessem noexteriormargem da página (levando em consideração páginas pares e ímpares). Primeiro tentei usar o thmtoolspacote (código e imagem abaixo). Porém, só consegui colocar a etiqueta sempre na margem esquerda. Em particular, não tenho ideia de como combinar thmtoolscom ifoddpage.

Em seguida, tentei ntheorem(código e imagem abaixo). Com ntheorem, o posicionamento do rótulo funcionou como deveria, mas não consegui alterar o estilo da fonte do título do teorema ("Algum Teorema Importante" nas imagens abaixo) e colocá-lo em uma linha própria. Além disso, não consegui me livrar do recuo. Finalmente, também quebrou minhas autorefreferências.

Pararesumir: O que estou procurando é um ambiente de teorema que permita

  • rótulos emexteriormargens da página (páginas ímpares/pares)
  • controle total de estilo para rótulos, título e corpo
  • autorefcompatibilidade (em particular, gostaria de usar um único contador para diferentes ambientes de teoremas, como Teorema, Definição, etc.)

Estou prestes a desistir, então realmente espero que alguém possa me ajudar com isso.

Código para 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}

Código para 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}

insira a descrição da imagem aqui

Responder1

Continuei procurando uma resposta e o seguinte funcionou para mim (pensei ter tentado isso antes e não compilou...):

\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}

informação relacionada