I want to create a custom Definition environment. The environment should use some local commands to declare logical parts of the definition (e.g. assumptions using a command Let
). The definition text should be plain text (not wrapped in a command).
I want to store and process all information in the end group of the environment (e.g. for dynamic formatting). For the definition text, I'm using the savebox command within the begin group of the environment.
My problem is: when I simply use \usebox
in the environment's end group the box overflows and some content is cut off. How can I prevent or work around this?
MWE:
\documentclass[a4paper,11pt]{article}
\usepackage{etoolbox}
\usepackage{lipsum}
\newcommand{\DefinitionLet}[3][]{%
}
\newsavebox{\DefinitionContentBox}
\newenvironment{Definition}[1][]{%
\let\Let\DefinitionLet%
\def\DefinitionName{#1}
\savebox{\DefinitionContentBox}\bgroup%
}{%
\egroup%
\noindent (Definition) \DefinitionName\\
\newline\usebox{\DefinitionContentBox}
}
\begin{document}
\begin{Definition}[Definition A]
\Let{$A$}{some set}
\Let{$a$}{element of $A$}
\lipsum[100]
\end{Definition}
\end{document}
\unbox
instead of\usebox
). I think you're interested to theenviron
package. – egreg yesterday\unbox
is an undefined command. Do I need a package? – FK82 yesterday\unhbox
; but you should make clearer what you have in mind: I don't see any real advantage in storing the environment's content, as the typesetting parameters can be set in the “begin” part. By the way, note that\savebox{<box bin>}\bgroup
is not really supported. – egreg yesterday\savebox{\DefinitionContentBox}\bgroup%
is absolutely not supported syntax!!! Use thelrbox
environment. – David Carlisle yesterdayLet
commands in a list (above or below the definition text). – FK82 yesterday