How can i get the default font name? \the\font outputs nothing in my case. For the default font, does it use any cmap file?

  • 1
    I would recommend marking some of your questions as "answered" by clicking the "tick mark" by the answer that does best at answering the question – Seamus Feb 17 '11 at 16:38

Usually you write \fontname\font instead to extract the name (and size) of the currently selected font. The first thing that comes to mind for \the\font is when you want to define a create to switch to what is the currently font:

\expandafter \let \expandafter \switchback \the\font
previous font

As such, \the\font on its own is pretty much a no-op as it switches to the currently selected font.

| improve this answer | |
  • your code seemed that it can define a font just for some text, for others, it still used the default font. am i right? – warem Feb 18 '11 at 2:56
  • @warem yes, but what exactly are you trying to do? Are you using LaTeX? – Will Robertson Feb 19 '11 at 1:14
  • nothing special. i just found there was no configuration about font in my tex source. i am curious about what the default font is. then i read some document and get \the\font will show something. but it didn't. this is why i asked this question. but your answer is really useful tip for me. – warem Feb 19 '11 at 10:22

LaTeX keep the current values of the font attributes in internal macros. For example f@family will give you the family.


Similarly \f@encoding, \f@shape, \f@series etc.

| improve this answer | |
  • using your code, i got cmr. what does it mean? i can't find any cmap file about cmr. i only found some pk font for it in local tex directory. for a newbie, font really made me feel depressed. – warem Feb 18 '11 at 2:53
  • @warem Computer Modern is the family of typefaces used by default by the typesetting program TeX. It was created by Donald Knuth. (cmr is computer modern roman). Why would you get depressed over a font? – Yiannis Lazarides Feb 18 '11 at 5:10
  • for a newbie, i start to use tex by google. it means i google something then use it in tex code. in some case, due to poor base knowledge, the code doesn't work for me but works for others. no matter how i try it, it doesn't work. it made me feel depressed. – warem Feb 18 '11 at 7:28

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.