In a book I defined an individual table as follows:

  % Caption
  % Label

When I uncomment the two \fontfamily statements, pdflatex.exe is running forever. This happens independently of the TeX editor I am using and the TeX distribution (TeX Live and MiKTeX).

I guess that something in the environment definition must cause the problem, but I cannot figure out, what that might be.

  • 3
    Welcome! \fontfamily expects something like phv as an argument. If you just want the default serif, use \rmfamily - no need for \fontfamily or \selectfont. Similarly for \sffamily. If you need more help please post compilable code or code which produces the error when we try to compile it. – cfr Jun 23 '18 at 0:31
  • I will give \sffamily / \rmfamily a try - thank you! I took the code from other postings, that I read about changing the font in an environment. – StackExchange42 Jun 23 '18 at 0:37
  • Either you misunderstood something or the code you found is erroneous. Do you have a link? If it is on this site, it should be corrected if it is really as you say. – cfr Jun 23 '18 at 0:39
  • I read tex.stackexchange.com/questions/28494/… - and that made me think that this were the way to go - but I probably misunderstood the thread. – StackExchange42 Jun 23 '18 at 1:39
  • I think you are just trying to mix bits from different answers/comments which are of different kinds. Note that the example with \fontfamily{} uses a name and not a macro in the argument, pcr. Moreover, as noted in the comments, just using \ttfamily instead of \fontfamily{pcr}\selectfont would be better (simpler, more flexible, more consistent). Maybe you read the suggestion as saying to just substitute the pcr rather than the whole line? – cfr Jun 23 '18 at 1:44

\rmfamily, \sffamily and \ttfamily are self-sufficient font switches. You do not need \fontfamily or \selectfont with these and they aren't suitable as arguments to \selectfont.

\fontfamily expects the name of a font family e.g. phv, clm2dj or AnnSton. You can't give it an argument which is itself a font-switching macro.

So just use





If you need further help, please post code for a minimal document we can compile to reproduce the problem.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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