I'll ask the question first and then explain why it is so. I have the following .tex file:
\documentclass{article} \newsavebox{\myquote} \setbox\myquote=\hbox{\begin{normalsize}\verb.'.\end{normalsize}} \usepackage{upquote} % convert verbatim ' from left single quote to a "normal" single quote \begin{document} Test: \verb.'. vs \usebox{\myquote} \end{document} In this tex file, the \verb.'. turns out as a ', and the \usebox{\myquote} looks like a curly left single quote. This is because even though I \usepackage{upquote} (which converts the curly left single quote to the straight single quote within verbatim/verb), it's loaded in after the definition of \myquote so it's too late for the upquote package to affect what sort of quote happens in \myquote.
Question: assuming I can only put code after the \setbox line, is there some way to make the quote mark in \myquote appear as a straight single quote?
I am basically looking to add a command like \edef\myquote\myquote after the \usepackage{upquote}, so that the definition of \myquote is basically re-evaluated before assigning it back to \myquote. The re-evaluation will cause the \verb.'. to be parsed according to the modifications made in \usepackage{upquote}, causing the quote to be a single quote again.
You may ask why I don't use load upquote before I define myquote; well, I am using a document generation package called Sweave (for the language R). I basically can embed write R code into my (otherwise LaTeX-looking) document, call Sweave on it, and it will produce a .tex file with the code (& results) nicely printed within. Sweave inserts all of these \newsavebox commands before the preamble that I put in the original document. That is, I cannot change the order of the \newsavebox command to be after the \usepackage{upquote}.
As a last resort I can copy/paste the \setbox\myquote=\hbox... that gets generated by Sweave into my own document preamble (i.e. after the \usepackage{upquote}), but then should the Sweave package change their definition of \myquote (say they change the normalsize to something else) I'll have to change my definition to remain in sync.
It'd be preferable to do the re-definition as if I only knew the command was \myquote (and knowing it has \verb.'. in it somewhere so that I know the upquote package will have effect) and not its actual definition.
I hope that makes sense.
\begin{normalsize}\verb.'.\end{normalsize}(which BTW should be\normalsize\verb.'.) is not present and available any longer. The box register already contains the lower level typesetting material, which AFAIK can't be really changed any longer.\setboxline & copying it to my preamble after I load in\upquotefor now (I know the definitions are not as elegant as they could be, but I have no control over them - they are generated). cheers!begin[document}laTeX makes a paragraph break be an error in that context to discourages but allows single line setbox/savebox settings for legacy compatibility. However many aspects of the font setup are not initialised until begin[document} even if you don't load any packages. (in case you do load packages)