A quick browse of the code (in the later sections of thmtools.pdf
) shows that the macro \NODE
itself is inserting a space before the opening parenthesis. If you don't mind being crude, you can do the following:
\newlength{\spacelength}
\settowidth{\spacelength}{\normalfont\ }
\declaretheoremstyle[
headfont=\bfseries,
notefont=\normalfont,
bodyfont=\itshape,
headpunct=\newline,
headformat={%
\makebox[0pt][r]{\NAME\ \NUMBER\ }\hskip-\spacelength{\NOTE}%
},
]{theorem}
This is somewhat of an old question but I was interested in how to put a line down the margin, where the side changes depending on the parity of the page number.
Rather than using the mdfamed package I have used tcolorbox as I am more used to using it. For answer this question, tcolorbox has one particularly useful switch, toggle left and right
, that can be used to swap the role of left and right in various instances. This is what is used to address point #2 in the OPs question.
Apart from this it is fairly straightforward except for the creation of a new theorem "style" for use by \newtcbtheorem
to cater for the particular style required by the question. This is done by the line
\tcbset{theorem style/theorem wide name and number/.code={
\let\tcb@theo@title=\tcb@theo@widetitle}
}
with the associated macro \tcb@theo@widetitle
doing the actual work.
This the output
from the following code (updated for tcolorbox
version 1.14, with breakable
added to the theorem style to allow it also to break over pages)
\documentclass[a4paper,twoside,11pt]{article}
\usepackage{amsmath,amsthm,amsfonts}
\usepackage{lipsum}
%% Other Packages %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{tcolorbox}
\tcbuselibrary{skins,breakable,theorems}
\usepackage{changepage}% for use of \ifoddpage below
% Theorems ==============
\definecolor{thmBgColor}{RGB}{250,250,250}
\definecolor{thmLnColor}{RGB}{200,200,200}
\makeatletter
% define a new theorem style
\def\tcb@theo@widetitle#1#2#3{\hbox to \textwidth{\textsc{\large#1}\normalsize\space#3\hfil(#2)}}
\tcbset{
theorem style/theorem wide name and number/.code={ \let\tcb@theo@title=\tcb@theo@widetitle},
proofbox/.style={skin=enhancedmiddle,breakable,parbox=false,boxrule=0mm,
check odd page, toggle left and right, colframe=thmLnColor,
leftrule=8pt, rightrule=0mm, boxsep=0mm,arc=0mm, outer arc=0mm,
left=3mm,right=0mm,top=0mm,bottom=0mm, toptitle=0mm,
bottomtitle=0mm,colback=white,
before={\par\vskip-2pt},after={\par\smallbreak},
},
}
\newtcolorbox{ProofBox}{proofbox}
\makeatother
\newtcbtheorem[use counter=equation, number within=section]{mytheorem}{Theorem}%
{theorem style=theorem wide name and number,enhanced,breakable,
arc=0mm,outer arc=0mm,parbox=false,
boxrule=0mm,toprule=2pt,bottomrule=2pt,left=1mm,right=1mm,
titlerule=0mm,toptitle=0mm,bottomtitle=0mm,top=0mm,
colback=thmBgColor,colframe=thmLnColor,
title style={color=thmBgColor}, coltitle=black,
attach title to upper={\par\noindent},
before={\par\vfill\smallbreak\noindent}, after={\par},
fonttitle=\normalfont\large,
}{thm}
\newenvironment{theorem}[2][]{\noindent\mytheorem{#1}{#2}}{\endmytheorem}
\let\realproof\proof
\let\realendproof\endproof
\renewenvironment{proof}[1][Proof]{\ProofBox\strut\textsc{#1}\space}{\endProofBox}
%% Style Definitions
\numberwithin{equation}{section}
\begin{document}
\quad\clearpage % to make it easier to get a screenshot with two pages
\section{Section A}
\label{sec:SectionA}
\begin{theorem}[about something important]{important}
This is some important theorem with equations
\[
1 + 1 = 0 \;,
\]
and text.
\end{theorem}
\begin{proof}
\lipsum*[1-8] Theorem \eqref{thm:important}.
\end{proof}
\begin{theorem}[about something important]{veryImportant}
This is some important theorem with equations
\[
1 + 1 = 0 \;,
\]
and text.
It continues for some more lines, so that a page break occurs during
its statement.
\end{theorem}
\begin{proof}[Proof of something important]
\lipsum[1]
\end{proof}
\end{document}
Best Answer
You can do that easily with
ntheorem
: