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.

how can i get the default font name? \the\font outputted nothing in my case. for the default font, does it use any cmap file?

share|improve this question
    
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
add comment

2 Answers

up vote 2 down vote accepted

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
\font\1=cmss10\1
hello
\switchback
previous font

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

share|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
add comment

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

\documentclass{article}
\begin{document}
\makeatletter
\f@family
\makeatother
\end{document}

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

share|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
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.