I wanted to create a documentclass for a complex template. I ran into the following problem:
- I want to have user macros to store content in boxes which are then displayed by the template in the class code
- I have to measure those boxes in order to set the dimensions of my layout
- I would like my layout to be in the document class, and not in the document source file
- I would like to be able to use user macros for storing the above-mentioned content in my document source file
Is that possible?
As a small example, let's pretend I want to create a frame using TikZ
which would be big enough to accomodate user provided text . I would want something in the lines of:
documentclass:
...
\newsavebox{\titlebox}
\sbox{\titlebox}{\parbox{\5cm}{\UserProvidedText}}
\newlength\titleheight
\settototalheight\titleheight{\usebox{\titlebox}}
\begin{tikzpicture}[remember picture, overlay]
\draw (0,0) rectangle (5cm,\titleheight) {\UserProvidedText};
\end{tikzpicture}
document source:
%provide \UserProvidedText somehow
As I see it, documentclass needs to know about \UserProvidedText
before the document source is itself read (I am presuming that TeX simply reads documentclass, and then goes on with reading the rest of the source).