TeX - LaTeX Asked by Kyuhunter on January 8, 2021
I want to create basically a shortcut for
begin{sometheorem}[optional parameter]
leavevmode vspace{-baselineskip}vspace{-baselineskip}vspace{3pt} %some space adjustments
begin{leftbar}
some text
end{leftbar}
end{sometheorem}
so i tried:
newenvironment{defi}[1]
{
begin{definition}[#1]
leavevmode vspace{-baselineskip}vspace{-baselineskip}vspace{3pt}
begin{leftbar}noindent
}
{
end{leftbar}
end{definition}
}
But this gives me
Theorem (])
Optional parameter] some text
What can i do, to properly pass the parameter along?
Edit: I am using the framed package for leftbar and amsthm for the theorems.
You need to branch on whether the optional argument is given or not.
documentclass{article}
usepackage{framed}
newtheorem{innertheorem}{Theorem}
newenvironment{theorem}[1][]
{ifrelaxdetokenize{#1}relax
begin{innertheorem}%
else
begin{innertheorem}[#1]%
fi
mbox{}parnobreak
vspace{-baselineskip}vspace{3pt}%
begin{leftbar}noindentignorespaces}
{end{leftbar}end{innertheorem}}
begin{document}
begin{theorem}
Some statement Some statement Some statement
Some statement Some statement Some statement
Some statement Some statement
end{theorem}
begin{theorem}[Something]
Some statement Some statement Some statement
Some statement Some statement Some statement
Some statement Some statement
end{theorem}
end{document}
Correct answer by egreg on January 8, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP