How to create a framed proof attached to a theorem?
up vote
10
down vote
favorite
I am trying to create a customized "proof" environment attached to a theorem. It looks like this:
So there is first the theorem, and then a gray bar starts on the inner margin. It ends, when the proof of the theorem is finished. It should also be possible to give a theorem without proof of cause.
The document you see above was created from the following code:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% HEADER
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
documentclass[a4paper,twoside,11pt]{article}
special{papersize=210mm,297mm}
%% Language %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
usepackage[USenglish]{babel}
usepackage[T1]{fontenc}
usepackage[ansinew]{inputenc}
usepackage{lmodern} % Type1-font for non-english texts and characters
%% Math Symbols %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
usepackage{amsmath}
usepackage{amsthm}
usepackage{amsfonts}
%% Other Packages %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
usepackage{color} % colors
usepackage{framed} % frames
usepackage{mdframed} % better frames
usepackage{fancyhdr} % Fancy headings
%% Style Definitions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
numberwithin{equation}{section}
% My Theorem Style ============================================================
newtheoremstyle{myThmStyle}% name of the theorem
{6pt}% habovespacei
{6pt}% hbelowspacei
{itshape}% font
{}% hindenti
{}% hheadfonti
{}% hheadpuncti
{ }% hheadspacei
{thmname{normalfontlargetextsc{#1}normalsize} thmnote{#3:} thmnumber{ hfill normalfont(#2)}\[1pt]}
% Frame Styles ================================================================
definecolor{thmBgColor}{RGB}{250,250,250}
definecolor{thmLnColor}{RGB}{200,200,200}
mdfdefinestyle{MDFStyGrayScreen}{%
linecolor=thmLnColor,
backgroundcolor=thmBgColor,
linewidth=1pt,
topline=true,
bottomline=true,
rightline=false,
leftline=false,
outerlinewidth=2pt,
roundcorner=0pt,
innertopmargin=4pt, %baselineskip
innerbottommargin=4pt, %baselineskip,
innerrightmargin=3pt,
innerleftmargin=3pt,
skipabove=topskip,
skipbelow=topskip,
nobreak=true
}
% Thorems =====================================================================
theoremstyle{myThmStyle}
newtheorem{myTheorem}[equation]{theorem}
% Proof environment ===========================================================
% (attached to theorem)
newenvironment{myTheoremEnvEx}[1][hsize]
{%
defFrameCommand
{%
{color{thmLnColor}vrule width 8pt}%
hspace{0pt}%must no space.
fboxsep=5ptcolorbox{white}%
}%
vspace{-topskip}
vspace{-topskip}
vspace{-1pt}
MakeFramed{hsize#1advancehsize-widthnoindentFrameRestore}%
}
{endMakeFramed}
setlength{FrameSep}{0pt}
% Theorem environment =========================================================
newenvironment{theorem}[1]
{
begin{mdframed}[style=MDFStyGrayScreen]
begin{myTheorem}#1
}
{
end{myTheorem}
end{mdframed}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% DOCUMENT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
begin{document}
section{Section A}
label{sec:SectionA}
begin{theorem}[about something important] label{thm:important}
This is some important theorem with equations
[
1 + 1 = 0 ;,
]
and text.
end{theorem}
Some text with reference to theorem eqref{thm:important}.
begin{theorem}[about something important] label{thm:veryImportant}
This is some important theorem with equations
[
1 + 1 = 0 ;,
]
and text.
end{theorem}%
begin{myTheoremEnvEx}
Proof of something important... The proof may exceed several pages. The proof may exceed several pages. The proof may exceed several pages.
The proof may exceed several pages. The proof may exceed several pages. The proof may exceed several pages.
end{myTheoremEnvEx}
end{document}
There are two things that do not work yet:
- When the text within the proof exceeds one page, then there appears a small gap between theorem and proof.
- The gray bar of the proof is currently always on the left side. But I want it to be on the inner margin (left for right pages and right for left pages).
The first problem is certainly due to my dirty bugfix
vspace{-topskip}
vspace{-topskip}
vspace{-1pt}
within newenvironment{myTheoremEnvEx}[1][hsize]
.
Can you help me with this? I'd also be happy to see better solutions.
environments theorems mdframed amsthm
add a comment |
up vote
10
down vote
favorite
I am trying to create a customized "proof" environment attached to a theorem. It looks like this:
So there is first the theorem, and then a gray bar starts on the inner margin. It ends, when the proof of the theorem is finished. It should also be possible to give a theorem without proof of cause.
The document you see above was created from the following code:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% HEADER
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
documentclass[a4paper,twoside,11pt]{article}
special{papersize=210mm,297mm}
%% Language %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
usepackage[USenglish]{babel}
usepackage[T1]{fontenc}
usepackage[ansinew]{inputenc}
usepackage{lmodern} % Type1-font for non-english texts and characters
%% Math Symbols %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
usepackage{amsmath}
usepackage{amsthm}
usepackage{amsfonts}
%% Other Packages %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
usepackage{color} % colors
usepackage{framed} % frames
usepackage{mdframed} % better frames
usepackage{fancyhdr} % Fancy headings
%% Style Definitions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
numberwithin{equation}{section}
% My Theorem Style ============================================================
newtheoremstyle{myThmStyle}% name of the theorem
{6pt}% habovespacei
{6pt}% hbelowspacei
{itshape}% font
{}% hindenti
{}% hheadfonti
{}% hheadpuncti
{ }% hheadspacei
{thmname{normalfontlargetextsc{#1}normalsize} thmnote{#3:} thmnumber{ hfill normalfont(#2)}\[1pt]}
% Frame Styles ================================================================
definecolor{thmBgColor}{RGB}{250,250,250}
definecolor{thmLnColor}{RGB}{200,200,200}
mdfdefinestyle{MDFStyGrayScreen}{%
linecolor=thmLnColor,
backgroundcolor=thmBgColor,
linewidth=1pt,
topline=true,
bottomline=true,
rightline=false,
leftline=false,
outerlinewidth=2pt,
roundcorner=0pt,
innertopmargin=4pt, %baselineskip
innerbottommargin=4pt, %baselineskip,
innerrightmargin=3pt,
innerleftmargin=3pt,
skipabove=topskip,
skipbelow=topskip,
nobreak=true
}
% Thorems =====================================================================
theoremstyle{myThmStyle}
newtheorem{myTheorem}[equation]{theorem}
% Proof environment ===========================================================
% (attached to theorem)
newenvironment{myTheoremEnvEx}[1][hsize]
{%
defFrameCommand
{%
{color{thmLnColor}vrule width 8pt}%
hspace{0pt}%must no space.
fboxsep=5ptcolorbox{white}%
}%
vspace{-topskip}
vspace{-topskip}
vspace{-1pt}
MakeFramed{hsize#1advancehsize-widthnoindentFrameRestore}%
}
{endMakeFramed}
setlength{FrameSep}{0pt}
% Theorem environment =========================================================
newenvironment{theorem}[1]
{
begin{mdframed}[style=MDFStyGrayScreen]
begin{myTheorem}#1
}
{
end{myTheorem}
end{mdframed}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% DOCUMENT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
begin{document}
section{Section A}
label{sec:SectionA}
begin{theorem}[about something important] label{thm:important}
This is some important theorem with equations
[
1 + 1 = 0 ;,
]
and text.
end{theorem}
Some text with reference to theorem eqref{thm:important}.
begin{theorem}[about something important] label{thm:veryImportant}
This is some important theorem with equations
[
1 + 1 = 0 ;,
]
and text.
end{theorem}%
begin{myTheoremEnvEx}
Proof of something important... The proof may exceed several pages. The proof may exceed several pages. The proof may exceed several pages.
The proof may exceed several pages. The proof may exceed several pages. The proof may exceed several pages.
end{myTheoremEnvEx}
end{document}
There are two things that do not work yet:
- When the text within the proof exceeds one page, then there appears a small gap between theorem and proof.
- The gray bar of the proof is currently always on the left side. But I want it to be on the inner margin (left for right pages and right for left pages).
The first problem is certainly due to my dirty bugfix
vspace{-topskip}
vspace{-topskip}
vspace{-1pt}
within newenvironment{myTheoremEnvEx}[1][hsize]
.
Can you help me with this? I'd also be happy to see better solutions.
environments theorems mdframed amsthm
You can do this very simple by defining a single command which ends up the first framed environment and start the next one.
– Marco Daniel
Jun 27 '13 at 16:59
Maybe the thmbox package could provide a good starting point?
– Clément
May 12 '15 at 23:10
add a comment |
up vote
10
down vote
favorite
up vote
10
down vote
favorite
I am trying to create a customized "proof" environment attached to a theorem. It looks like this:
So there is first the theorem, and then a gray bar starts on the inner margin. It ends, when the proof of the theorem is finished. It should also be possible to give a theorem without proof of cause.
The document you see above was created from the following code:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% HEADER
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
documentclass[a4paper,twoside,11pt]{article}
special{papersize=210mm,297mm}
%% Language %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
usepackage[USenglish]{babel}
usepackage[T1]{fontenc}
usepackage[ansinew]{inputenc}
usepackage{lmodern} % Type1-font for non-english texts and characters
%% Math Symbols %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
usepackage{amsmath}
usepackage{amsthm}
usepackage{amsfonts}
%% Other Packages %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
usepackage{color} % colors
usepackage{framed} % frames
usepackage{mdframed} % better frames
usepackage{fancyhdr} % Fancy headings
%% Style Definitions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
numberwithin{equation}{section}
% My Theorem Style ============================================================
newtheoremstyle{myThmStyle}% name of the theorem
{6pt}% habovespacei
{6pt}% hbelowspacei
{itshape}% font
{}% hindenti
{}% hheadfonti
{}% hheadpuncti
{ }% hheadspacei
{thmname{normalfontlargetextsc{#1}normalsize} thmnote{#3:} thmnumber{ hfill normalfont(#2)}\[1pt]}
% Frame Styles ================================================================
definecolor{thmBgColor}{RGB}{250,250,250}
definecolor{thmLnColor}{RGB}{200,200,200}
mdfdefinestyle{MDFStyGrayScreen}{%
linecolor=thmLnColor,
backgroundcolor=thmBgColor,
linewidth=1pt,
topline=true,
bottomline=true,
rightline=false,
leftline=false,
outerlinewidth=2pt,
roundcorner=0pt,
innertopmargin=4pt, %baselineskip
innerbottommargin=4pt, %baselineskip,
innerrightmargin=3pt,
innerleftmargin=3pt,
skipabove=topskip,
skipbelow=topskip,
nobreak=true
}
% Thorems =====================================================================
theoremstyle{myThmStyle}
newtheorem{myTheorem}[equation]{theorem}
% Proof environment ===========================================================
% (attached to theorem)
newenvironment{myTheoremEnvEx}[1][hsize]
{%
defFrameCommand
{%
{color{thmLnColor}vrule width 8pt}%
hspace{0pt}%must no space.
fboxsep=5ptcolorbox{white}%
}%
vspace{-topskip}
vspace{-topskip}
vspace{-1pt}
MakeFramed{hsize#1advancehsize-widthnoindentFrameRestore}%
}
{endMakeFramed}
setlength{FrameSep}{0pt}
% Theorem environment =========================================================
newenvironment{theorem}[1]
{
begin{mdframed}[style=MDFStyGrayScreen]
begin{myTheorem}#1
}
{
end{myTheorem}
end{mdframed}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% DOCUMENT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
begin{document}
section{Section A}
label{sec:SectionA}
begin{theorem}[about something important] label{thm:important}
This is some important theorem with equations
[
1 + 1 = 0 ;,
]
and text.
end{theorem}
Some text with reference to theorem eqref{thm:important}.
begin{theorem}[about something important] label{thm:veryImportant}
This is some important theorem with equations
[
1 + 1 = 0 ;,
]
and text.
end{theorem}%
begin{myTheoremEnvEx}
Proof of something important... The proof may exceed several pages. The proof may exceed several pages. The proof may exceed several pages.
The proof may exceed several pages. The proof may exceed several pages. The proof may exceed several pages.
end{myTheoremEnvEx}
end{document}
There are two things that do not work yet:
- When the text within the proof exceeds one page, then there appears a small gap between theorem and proof.
- The gray bar of the proof is currently always on the left side. But I want it to be on the inner margin (left for right pages and right for left pages).
The first problem is certainly due to my dirty bugfix
vspace{-topskip}
vspace{-topskip}
vspace{-1pt}
within newenvironment{myTheoremEnvEx}[1][hsize]
.
Can you help me with this? I'd also be happy to see better solutions.
environments theorems mdframed amsthm
I am trying to create a customized "proof" environment attached to a theorem. It looks like this:
So there is first the theorem, and then a gray bar starts on the inner margin. It ends, when the proof of the theorem is finished. It should also be possible to give a theorem without proof of cause.
The document you see above was created from the following code:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% HEADER
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
documentclass[a4paper,twoside,11pt]{article}
special{papersize=210mm,297mm}
%% Language %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
usepackage[USenglish]{babel}
usepackage[T1]{fontenc}
usepackage[ansinew]{inputenc}
usepackage{lmodern} % Type1-font for non-english texts and characters
%% Math Symbols %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
usepackage{amsmath}
usepackage{amsthm}
usepackage{amsfonts}
%% Other Packages %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
usepackage{color} % colors
usepackage{framed} % frames
usepackage{mdframed} % better frames
usepackage{fancyhdr} % Fancy headings
%% Style Definitions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
numberwithin{equation}{section}
% My Theorem Style ============================================================
newtheoremstyle{myThmStyle}% name of the theorem
{6pt}% habovespacei
{6pt}% hbelowspacei
{itshape}% font
{}% hindenti
{}% hheadfonti
{}% hheadpuncti
{ }% hheadspacei
{thmname{normalfontlargetextsc{#1}normalsize} thmnote{#3:} thmnumber{ hfill normalfont(#2)}\[1pt]}
% Frame Styles ================================================================
definecolor{thmBgColor}{RGB}{250,250,250}
definecolor{thmLnColor}{RGB}{200,200,200}
mdfdefinestyle{MDFStyGrayScreen}{%
linecolor=thmLnColor,
backgroundcolor=thmBgColor,
linewidth=1pt,
topline=true,
bottomline=true,
rightline=false,
leftline=false,
outerlinewidth=2pt,
roundcorner=0pt,
innertopmargin=4pt, %baselineskip
innerbottommargin=4pt, %baselineskip,
innerrightmargin=3pt,
innerleftmargin=3pt,
skipabove=topskip,
skipbelow=topskip,
nobreak=true
}
% Thorems =====================================================================
theoremstyle{myThmStyle}
newtheorem{myTheorem}[equation]{theorem}
% Proof environment ===========================================================
% (attached to theorem)
newenvironment{myTheoremEnvEx}[1][hsize]
{%
defFrameCommand
{%
{color{thmLnColor}vrule width 8pt}%
hspace{0pt}%must no space.
fboxsep=5ptcolorbox{white}%
}%
vspace{-topskip}
vspace{-topskip}
vspace{-1pt}
MakeFramed{hsize#1advancehsize-widthnoindentFrameRestore}%
}
{endMakeFramed}
setlength{FrameSep}{0pt}
% Theorem environment =========================================================
newenvironment{theorem}[1]
{
begin{mdframed}[style=MDFStyGrayScreen]
begin{myTheorem}#1
}
{
end{myTheorem}
end{mdframed}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% DOCUMENT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
begin{document}
section{Section A}
label{sec:SectionA}
begin{theorem}[about something important] label{thm:important}
This is some important theorem with equations
[
1 + 1 = 0 ;,
]
and text.
end{theorem}
Some text with reference to theorem eqref{thm:important}.
begin{theorem}[about something important] label{thm:veryImportant}
This is some important theorem with equations
[
1 + 1 = 0 ;,
]
and text.
end{theorem}%
begin{myTheoremEnvEx}
Proof of something important... The proof may exceed several pages. The proof may exceed several pages. The proof may exceed several pages.
The proof may exceed several pages. The proof may exceed several pages. The proof may exceed several pages.
end{myTheoremEnvEx}
end{document}
There are two things that do not work yet:
- When the text within the proof exceeds one page, then there appears a small gap between theorem and proof.
- The gray bar of the proof is currently always on the left side. But I want it to be on the inner margin (left for right pages and right for left pages).
The first problem is certainly due to my dirty bugfix
vspace{-topskip}
vspace{-topskip}
vspace{-1pt}
within newenvironment{myTheoremEnvEx}[1][hsize]
.
Can you help me with this? I'd also be happy to see better solutions.
environments theorems mdframed amsthm
environments theorems mdframed amsthm
asked Jun 25 '13 at 8:23
John
14819
14819
You can do this very simple by defining a single command which ends up the first framed environment and start the next one.
– Marco Daniel
Jun 27 '13 at 16:59
Maybe the thmbox package could provide a good starting point?
– Clément
May 12 '15 at 23:10
add a comment |
You can do this very simple by defining a single command which ends up the first framed environment and start the next one.
– Marco Daniel
Jun 27 '13 at 16:59
Maybe the thmbox package could provide a good starting point?
– Clément
May 12 '15 at 23:10
You can do this very simple by defining a single command which ends up the first framed environment and start the next one.
– Marco Daniel
Jun 27 '13 at 16:59
You can do this very simple by defining a single command which ends up the first framed environment and start the next one.
– Marco Daniel
Jun 27 '13 at 16:59
Maybe the thmbox package could provide a good starting point?
– Clément
May 12 '15 at 23:10
Maybe the thmbox package could provide a good starting point?
– Clément
May 12 '15 at 23:10
add a comment |
1 Answer
1
active
oldest
votes
up vote
4
down vote
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={
lettcb@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
deftcb@theo@widetitle#1#2#3{hbox to textwidth{textsc{large#1}normalsizespace#3hfil(#2)}}
tcbset{
theorem style/theorem wide name and number/.code={ lettcb@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={parvskip-2pt},after={parsmallbreak},
},
}
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={parnoindent},
before={parvfillsmallbreaknoindent}, after={par},
fonttitle=normalfontlarge,
}{thm}
newenvironment{theorem}[2]{noindentmytheorem{#1}{#2}}{endmytheorem}
letrealproofproof
letrealendproofendproof
renewenvironment{proof}[1][Proof]{ProofBoxstruttextsc{#1}space}{endProofBox}
%% Style Definitions
numberwithin{equation}{section}
begin{document}
quadclearpage % 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}
I love this, not to revive an old thread though, but @Andrew is it possible to have the same thing for longer lemmas or theorems, sometimes I have my theorem starting at the end of a page, and it skips to next page since it won't let it span on two pages, is it possible to have it span over multiple pages?
– Sephya
yesterday
2
@Sephya Essentially just addbreakable
to the theorem style. I have updated my answer.
– Andrew Swann
20 hours ago
@AndrewSwann It looks like you have updated my answer:) Thanks!
– Andrew
7 hours ago
thank you so much 😊 really appreciated.
– Sephya
4 hours ago
@Andrew Oh, now I see yes - I seemed to get pinged by tags to you.
– Andrew Swann
41 secs ago
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
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={
lettcb@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
deftcb@theo@widetitle#1#2#3{hbox to textwidth{textsc{large#1}normalsizespace#3hfil(#2)}}
tcbset{
theorem style/theorem wide name and number/.code={ lettcb@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={parvskip-2pt},after={parsmallbreak},
},
}
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={parnoindent},
before={parvfillsmallbreaknoindent}, after={par},
fonttitle=normalfontlarge,
}{thm}
newenvironment{theorem}[2]{noindentmytheorem{#1}{#2}}{endmytheorem}
letrealproofproof
letrealendproofendproof
renewenvironment{proof}[1][Proof]{ProofBoxstruttextsc{#1}space}{endProofBox}
%% Style Definitions
numberwithin{equation}{section}
begin{document}
quadclearpage % 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}
I love this, not to revive an old thread though, but @Andrew is it possible to have the same thing for longer lemmas or theorems, sometimes I have my theorem starting at the end of a page, and it skips to next page since it won't let it span on two pages, is it possible to have it span over multiple pages?
– Sephya
yesterday
2
@Sephya Essentially just addbreakable
to the theorem style. I have updated my answer.
– Andrew Swann
20 hours ago
@AndrewSwann It looks like you have updated my answer:) Thanks!
– Andrew
7 hours ago
thank you so much 😊 really appreciated.
– Sephya
4 hours ago
@Andrew Oh, now I see yes - I seemed to get pinged by tags to you.
– Andrew Swann
41 secs ago
add a comment |
up vote
4
down vote
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={
lettcb@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
deftcb@theo@widetitle#1#2#3{hbox to textwidth{textsc{large#1}normalsizespace#3hfil(#2)}}
tcbset{
theorem style/theorem wide name and number/.code={ lettcb@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={parvskip-2pt},after={parsmallbreak},
},
}
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={parnoindent},
before={parvfillsmallbreaknoindent}, after={par},
fonttitle=normalfontlarge,
}{thm}
newenvironment{theorem}[2]{noindentmytheorem{#1}{#2}}{endmytheorem}
letrealproofproof
letrealendproofendproof
renewenvironment{proof}[1][Proof]{ProofBoxstruttextsc{#1}space}{endProofBox}
%% Style Definitions
numberwithin{equation}{section}
begin{document}
quadclearpage % 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}
I love this, not to revive an old thread though, but @Andrew is it possible to have the same thing for longer lemmas or theorems, sometimes I have my theorem starting at the end of a page, and it skips to next page since it won't let it span on two pages, is it possible to have it span over multiple pages?
– Sephya
yesterday
2
@Sephya Essentially just addbreakable
to the theorem style. I have updated my answer.
– Andrew Swann
20 hours ago
@AndrewSwann It looks like you have updated my answer:) Thanks!
– Andrew
7 hours ago
thank you so much 😊 really appreciated.
– Sephya
4 hours ago
@Andrew Oh, now I see yes - I seemed to get pinged by tags to you.
– Andrew Swann
41 secs ago
add a comment |
up vote
4
down vote
up vote
4
down vote
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={
lettcb@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
deftcb@theo@widetitle#1#2#3{hbox to textwidth{textsc{large#1}normalsizespace#3hfil(#2)}}
tcbset{
theorem style/theorem wide name and number/.code={ lettcb@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={parvskip-2pt},after={parsmallbreak},
},
}
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={parnoindent},
before={parvfillsmallbreaknoindent}, after={par},
fonttitle=normalfontlarge,
}{thm}
newenvironment{theorem}[2]{noindentmytheorem{#1}{#2}}{endmytheorem}
letrealproofproof
letrealendproofendproof
renewenvironment{proof}[1][Proof]{ProofBoxstruttextsc{#1}space}{endProofBox}
%% Style Definitions
numberwithin{equation}{section}
begin{document}
quadclearpage % 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}
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={
lettcb@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
deftcb@theo@widetitle#1#2#3{hbox to textwidth{textsc{large#1}normalsizespace#3hfil(#2)}}
tcbset{
theorem style/theorem wide name and number/.code={ lettcb@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={parvskip-2pt},after={parsmallbreak},
},
}
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={parnoindent},
before={parvfillsmallbreaknoindent}, after={par},
fonttitle=normalfontlarge,
}{thm}
newenvironment{theorem}[2]{noindentmytheorem{#1}{#2}}{endmytheorem}
letrealproofproof
letrealendproofendproof
renewenvironment{proof}[1][Proof]{ProofBoxstruttextsc{#1}space}{endProofBox}
%% Style Definitions
numberwithin{equation}{section}
begin{document}
quadclearpage % 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}
edited 20 hours ago
Andrew Swann
75.9k9126321
75.9k9126321
answered Jun 2 '15 at 12:26
Andrew
29.4k34178
29.4k34178
I love this, not to revive an old thread though, but @Andrew is it possible to have the same thing for longer lemmas or theorems, sometimes I have my theorem starting at the end of a page, and it skips to next page since it won't let it span on two pages, is it possible to have it span over multiple pages?
– Sephya
yesterday
2
@Sephya Essentially just addbreakable
to the theorem style. I have updated my answer.
– Andrew Swann
20 hours ago
@AndrewSwann It looks like you have updated my answer:) Thanks!
– Andrew
7 hours ago
thank you so much 😊 really appreciated.
– Sephya
4 hours ago
@Andrew Oh, now I see yes - I seemed to get pinged by tags to you.
– Andrew Swann
41 secs ago
add a comment |
I love this, not to revive an old thread though, but @Andrew is it possible to have the same thing for longer lemmas or theorems, sometimes I have my theorem starting at the end of a page, and it skips to next page since it won't let it span on two pages, is it possible to have it span over multiple pages?
– Sephya
yesterday
2
@Sephya Essentially just addbreakable
to the theorem style. I have updated my answer.
– Andrew Swann
20 hours ago
@AndrewSwann It looks like you have updated my answer:) Thanks!
– Andrew
7 hours ago
thank you so much 😊 really appreciated.
– Sephya
4 hours ago
@Andrew Oh, now I see yes - I seemed to get pinged by tags to you.
– Andrew Swann
41 secs ago
I love this, not to revive an old thread though, but @Andrew is it possible to have the same thing for longer lemmas or theorems, sometimes I have my theorem starting at the end of a page, and it skips to next page since it won't let it span on two pages, is it possible to have it span over multiple pages?
– Sephya
yesterday
I love this, not to revive an old thread though, but @Andrew is it possible to have the same thing for longer lemmas or theorems, sometimes I have my theorem starting at the end of a page, and it skips to next page since it won't let it span on two pages, is it possible to have it span over multiple pages?
– Sephya
yesterday
2
2
@Sephya Essentially just add
breakable
to the theorem style. I have updated my answer.– Andrew Swann
20 hours ago
@Sephya Essentially just add
breakable
to the theorem style. I have updated my answer.– Andrew Swann
20 hours ago
@AndrewSwann It looks like you have updated my answer:) Thanks!
– Andrew
7 hours ago
@AndrewSwann It looks like you have updated my answer:) Thanks!
– Andrew
7 hours ago
thank you so much 😊 really appreciated.
– Sephya
4 hours ago
thank you so much 😊 really appreciated.
– Sephya
4 hours ago
@Andrew Oh, now I see yes - I seemed to get pinged by tags to you.
– Andrew Swann
41 secs ago
@Andrew Oh, now I see yes - I seemed to get pinged by tags to you.
– Andrew Swann
41 secs ago
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f120964%2fhow-to-create-a-framed-proof-attached-to-a-theorem%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You can do this very simple by defining a single command which ends up the first framed environment and start the next one.
– Marco Daniel
Jun 27 '13 at 16:59
Maybe the thmbox package could provide a good starting point?
– Clément
May 12 '15 at 23:10