3

Getting a package is not the same as executing an instruction to tell TeX to use a specific font or fontsize or typestyle (like italics or boldface), right?

So I have this:

\documentclass[letterpaper]{article}

%% Language and font encodings
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}

%% Sets page size and margins
\usepackage[letterpaper,top=3cm,bottom=2cm,left=3cm,right=3cm,marginparwidth=1.75cm]{geometry}

%% Useful packages
\usepackage{amsmath}
\usepackage{mathrsfs}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage[colorinlistoftodos]{todonotes}
\usepackage[colorlinks=true, allcolors=blue]{hyperref}

\title{Your Paper}
\author{You}

\begin{document}
\maketitle

...

\end{document}

and I get this ostensibly vanilla-flavored font with serifs.

ostensibly vanilla-flavored font with serifs

Suppose one wants a sans-serif font like Helvetica or a plain mono-spaced font like we have in the edit boxes here at SE (or one like Courier)? Or a standard serif font like Times Roman?

Where do I get the different font packages and how do I tell TeX what the default document font is and how to switch from one font to another, to another font size, and to a different font style? FYI, I am using TeXworks with MiKTeX on a Windoze 10 PC.

I tried searching for another question like this and couldn't find it or, if I did, I couldn't decode it to even guess I had an answer.

  • 2
    Don't use utf8x - use utf8 if at all possible instead. – cfr Jul 3 '18 at 22:41
  • 2
    You may want to take a look at The LaTeX Font Catalogue, and in particular its maths fonts sections. – Bernard Jul 3 '18 at 22:41
  • 3
    This is really too much for one question: you are asking 'how do I do everything possible font related?' Have you read a basic introduction to LaTeX? If not, I urge you to do so as it will save you lots of time, frustration and heartache. – cfr Jul 3 '18 at 22:44
  • 1
    @robertbristow-johnson See tex.stackexchange.com/questions/11/…. – cfr Jul 3 '18 at 23:00
  • 1
    Read lshort.pdf where you learn everything an absolute novice needs. – Johannes_B Jul 4 '18 at 5:54
6

Your question asks about four broad areas:

  1. customising the font configuration for text;

  2. customising the font configuration for maths;

  3. how to switch between sans, serif, typewriter and special fonts, and how to change font size in text;

  4. how to switch between sans, serif, typewriter and special fonts, and how to change font size in maths.

The answer to 1 and 2 is that you load a suitable package or packages using

\usepackage[]{}

The LaTeX Font Catalogue can help with this, as Bernard suggested in comments. I also provide some resources which might be helpful. See What font packages are installed in TeX live? for a list of packages and this font sampler.

The answer to 3 and 4 is that, generally, you shouldn't. This is because something like 'switch to italic bold' is appearance mark-up rather than logical or semantic mark-up. Generally, such changes should be handled by the class and packages you load so that, say

\section{A section}

typesets A section in a suitable font. Similarly,

\emph{I really mean this.}

should be used where emphasis is needed because it is logical/semantic rather than appearance.

Occasionally, you may want something special for a one-off effect. A typical use would be in typesetting a title page. Then you might actually want to hard-code the appearance.

\textbf{Bold} or {\bfseries bold}
\textit{Italic} or {\itshape italics}
\textsc{Small-caps} or {\scshape small-caps}
\textsf{Sans} or {\sffamily sans}
\textrm{Serif} or {\rmfamily serif}
\texttt{Typewriter} or {\ttfamily typewriter}

{\tiny tiny\par
\scriptsize script\par
\footnotesize footnote\par
\small small\par
\normalsize normal\par
\large large\par\Large larger\par
\LARGE larger\par
\huge larger\par
\Huge largest\par}

font changes: family, shape, series and size

Generally, sizing etc. is automatic in maths mode. Where necessary, you can use

\mathit{Italics}
\mathsf{Sans}

and so on, but these should not usually be necessary.

For further information, see What are good learning resources for a LaTeX beginner?.

  • i didn't realize the question was as broad as you said. but there is a lotta content in this answer, so you might be right. i'll read (or at least peruse) whatever you have pointed me to, but the best thing for my noobie brain is example code that i can change and see the effect. i got this Overleaf sample to work in TeXworks and i can do the math markup pretty good (have been editing Wikipedia for 15 years and the DSP and Math StackExchange for about 5). and i got the math packages for the symbols that were missing. but i haven't yet done my first paper using LaTeX. total noob. – robert bristow-johnson Jul 4 '18 at 0:02
  • @robertbristow-johnson Well, that's why I gave you those lines you can cut-and paste to see what they do. There is a bit more to it than this e.g. font packages may add additional commands, but this is a good chunk of the basics. (I have a maybe slightly more comprehensive answer somewhere for text fonts, I think, but it might be Latin Modern specific.) There are also questions somewhere about e.g. typewriter fonts, fonts with small-caps, fonts with 'a's or 'g's of certain kinds etc. etc. – cfr Jul 4 '18 at 0:12
  • cfr, on the last line with all of the font sizes, it looks like several different commands. can you put the different commands on separate lines? if i knew what i was doing, i would edit your answer. but i am not sure where the "\par" goes. – robert bristow-johnson Jul 4 '18 at 0:18
  • 1
    @robertbristow-johnson \par just starts a new paragraph without leaving a blank line. The reason I did it this way was to: emphasise the fact that all of these commands are grouped ({ }) and the fact that you should not switch sizes within a single paragraph (\par is clearer than a blank line, even though technically equivalent). – cfr Jul 4 '18 at 0:32
  • 2
    @robertbristow-johnson Maybe a picture helps? – cfr Jul 4 '18 at 0:35

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.