Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Inside of a group, a command like \tiny has effect only until the group ends. One would like to be able to say \global\tiny to have it last after the group ends, but that does not work.

The best that I was able to come up with (described here) is the following.

\newif\ifhelper
\makeatletter
\def\unithelper#1\@nnil{\global\helpertrue\helper}
\def\helper{\ifhelper\afterassignment\helper\global\fi}
\newcommand*\globalfontsize[1]{%
\begingroup
       #1%
       \def\@defaultunits{\helperfalse\afterassignment\unithelper\global}%
       \let\realvrule\vrule
       \def\vrule{\helperfalse\global\helpertrue\afterassignment\helper\realvrule}%
       \global\helpertrue
       \helper#1%
       \helperfalse
\endgroup}
\makeatother

Then you can say \globalfontsize\tiny or \globalfontsize\normalsize to achieve the desired effect. What is the right way to do that?

Edit: Several people have suggested some variant of \documentclass[10pt]{article}. That is not related to my question. I'm using "global" in analogy to the TeX primitive \global.

share|improve this question
    
Without looking into too much detail into the NFSS code, I think this is about the best you're going to be able to do. –  Will Robertson Aug 22 '10 at 23:55
add comment

2 Answers

up vote 10 down vote accepted
\newcommand{\doglobally}[1]{{\globaldefs=1#1}}

Now you can write \doglobally\tiny

share|improve this answer
    
Excellent! I had completely forgotten about \globaldefs. According to the TeXbook's index, \globaldefs appears on exactly 3 pages (not counting the index itself). Good catch. –  TH. Aug 23 '10 at 1:20
add comment

For at least some font sizes, you can use something like \documentclass[12pt]{article}. However, I'm entirely sure which font sizes this works for---I do know it works for 10pt (the default) and 12pt.

share|improve this answer
    
I could have sworn there was a similar answer that I already commented on. My question is not about setting the fontsize for the document. It's about how to change the size in a manner that is analogous to TeX's \global. –  TH. Aug 22 '10 at 22:07
    
@TH. The previous answer has been deleted by its owner. –  Caramdir Aug 22 '10 at 23:35
    
But this is what I was looking for when I googled, so I'm upvoting. –  fotanus Nov 28 '13 at 14:31
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.