Tag Archives: How to Set Latex Font

Latex: How to Modify the Size of the Font

There are these types of fonts in latex:

\tiny
\scriptsize
\footnotesize
\small
\normalsize
\large
\Large
\LARGE
\huge
\Huge

Generally speaking, the default font size is \normalsize. We can redefine the default font size at the beginning:

\documnetclass[12pt]{article}

Just change the value of 12pt. Latex provides three sizes: 10 / 11 / 12pt

Or directly define the text size:

\fontsize{5.0pt}{\baselineskip}\selectfont  text

Change 0.5 to the number you want.

Latex: How to Set text Center

Click to view the original link

\centerline

Syntax: \centerline{text}
This is the original TeX command for centering short text.

center environment

Syntax
\begin{center}
First line \\\
second line \\\
\end{center}

The center environment allows multiple rows to be centered.
In the center environment, if the "first line" is too long, it will automatically wrap, and the text of the wrap is still centered, so this is a very common way to do it.

How to set font color in Latex (3 ways)

1. Use the defined color directly
\usepackage{color}

\textcolor{red/blue/green/black/white/cyan/magenta/yellow}{text}

where textcolor{…} contains the system-defined colors

 

2. Combine the values of red, green and blue to form the color we want
\usepackage{color}

\textcolor[rgb]{r,g,b}{text}

where {r,g,b} represents the combination of red, green and blue colors, and takes values in the range [0-1]

\textcolor[RGB]{R,G,B}{text}

where {R,G,B} represents the combination of red, green and blue colors, and the range of values is [0-255]

 

3. Define a color, call directly
\usepackage{color}

\definecolor{ColorName}{rgb}{r,g,b} This time r/g/b is defined in the range [0-1].

\definecolor{ColorName}{RGB}{R,G,B}, when the domain of R/G/B is defined in [0-255].

Here the name ColorName is defined for the color, and the following can call this color scheme directly

\textcolor{ColorName}{text}

How to Set latex text Bold & Italic

Show upright text: \textup{text}
italic: \textit{text}
slanted italic: \textsl{text}
Display lowercase uppercase text: \textsc{text}
Medium weight: \textmd{text}
Bold command: \textbf{text}
Default value: \textnormal{text}

Italic: \textit{italic}, or \emph{italic}

Fine font: \textlf{light font}

Use equal-width fonts: \texttt{code}

Use sans-serif font: \textsf{sans-serif}

All letters uppercase: \uppercase{CAPITALS}

All letters uppercase, but lowercase letters are smaller: \textsc{Small Capitals}