The Question
Can I use a TeX primitive in a "before" and "after" macro? (and how?)
There are two questions that I found useful and related to my question, which sent me in the right direction: how to even ask this question!
- What are the different kinds of boxes in (La)TeX?
- Why does LaTeX make a distinction between commands and environments?
- How to make a list of unbreakable items?
- How to prevent pagebreak in description environment
Example Situation
I am using a custom list setup with the enumitem package and I would like to use a primitive in the variables below:
\newlist{legal}{enumerate}{10}
\setlist[legal]{label*=\texttt{\arabic*.},resume,before={<HERE>}, after={<HERE>}}
I would like to put \vbox{ in the before={} and } in the after={}, but obviously I cannot type before={\vbox{}, after={}}
Why would I want to do this? For example, I could want to put a box around each mother and daughter list item, such that they remain on the same page. Or maybe I would like to put other primitives around my list environment just for kicks. Is there any way to do this?
\vbox. – Peter Grill May 11 '14 at 20:11before=\begin{minipage}{\textwidth}, after=\end{minipage}? – egreg May 11 '14 at 20:42minipageis not a TeX primitive, it is an environment. – Jonathan Komar May 11 '14 at 20:44\vbox\bgroupand\egroupbut they are not supported latex commands and things will go wrong if you do – David Carlisle May 11 '14 at 20:45legalenvironment would be enclosed in the vertical box, so no page break would be available. – egreg May 11 '14 at 20:47\fbox{}around a list, or other things. A pure answer that addresses the question and not any particular problem would be great! – Jonathan Komar May 11 '14 at 20:48mdframedandtcolorbox. Trying to do it with low level tools is likely to break many things. – egreg May 11 '14 at 20:50vbox\bgroupnot\vbox{and similarly\egroupnot}then you can put it in your macro arguments without messing up brace matching. But to put\fboxaround a list you should not do that you should use thelrboxenvironment which was explicitly added to latex for that example. – David Carlisle May 11 '14 at 21:49enumitemis already well "above" plain TeX, so I'm not sure what benefit there could possibly be from mixing in non-LaTeX code. If you want to go for a so-called "pure" solution, why not skip LaTeX all together and work in (e)plain TeX? Besides,lrboxis pretty low-level compared toenumitem.... – jon May 12 '14 at 02:43