無涯教程 - Latex 字體(Fonts)

Latex字體

我們通常在方括號[]中定義紙張大小和字體大小。

可以使用 [10pt] 來描述點的大小。其他字體大小爲8pt,9pt,10pt,11pt,12pt,14pt,17pt,20pt。

Latex的默認字體大小爲 10pt 

紙張類型及其尺寸如下:

  • letterpaper(11 x 8.5英寸)
  • legalpaper(14 x 8.5英寸)
  • a5paper(5.8 x 8.3英寸)
  • a4paper(8.3 x 11.7英寸)
  • executivepaper(10.5 x 7.25英寸)
  • b5paper(25 x 17.6釐米)

Latex尺寸

Tex生成的默認字體大小或類型大小爲10pt。有一些聲明用於更改類型大小。所有類型大小以及命令的表如下所示:

Latex Fonts Size and Styles

在上述順序中,\tiny 最小,而\Huge 最大。爲了理解,讓我們考慮以下示例:

\documentclass[a4paper]{letter}
\begin{document}
    \begin{center}
        \begin{huge}
            \textbf{The \LaTeX\Technical Would}
        \end{huge}
        
        \begin{LARGE}
            \textsc{\\LearnFK} 
        \end{LARGE}  
        
    \end{center}
    \noindent learnfk is a tutorial network for programmers technology introduction, including PHP, Java, Latex, Linux and other related tutorials -- from google translate
    
    \begin{flushright}
        \textsf{The Director}\\
            Hello LearnFK Would
    \end{flushright} %右對齊

\end{document}

下圖顯示了此代碼的輸出:

Latex Fonts Size and Styles

同樣,您可以根據要求更改字體和樣式。

Latex風格

樣式分爲family,seriesshape。輸出中的字體由這三個特徵組成。

styles的表格如下:

樣式 命令
Roman \textrm {roman}
Typewriter \texttt {typewriter}
Scans serif \textsf {sans serif}

series的表格如下:

樣式 命令
黑體 \textbf {boldface}
中體 \textmd {medium}

shape的表格如下:

樣式 命令
斜體 \textit {italic}
傾斜 \textsl {slanted}
豎立 \textup {upright}
小體大寫 \textsc {small cap}

下面給出了使用這三種類別的方式或過程:

\documentclass[12pt]{article}
\begin{document}
     %textbf:加粗,textit:斜體
    \textit{\textbf{ Welcome LearnFk Would.}}
    \\ %我要換行,嘎嘎

    \textrm{\textsl{  learnfk is a tutorial network for programmers technology introduction }}
\end{document}

此代碼的輸出將是:

Latex Fonts Size and Styles

如果要在單獨的行中顯示以上文本,請使用\newline 命令,如下所示:

 
\documentclass[12pt]{article}
\begin{document}
     %textbf:加粗,textit:斜體
    \textit{\textbf{ Welcome LearnFk Would.}}\newline

    \textrm{\textsl{  learnfk is a tutorial network for programmers technology introduction }}\newline
\end{document}

輸出:

Latex Fonts Size and Styles

還有另一個名爲\emph 的命令,用於樣式設置。它使用series和當前字體。

\emph 用於在普通(豎排)文本的中間產生斜體形狀。如果當前形式爲斜體,則將其切換爲直立形狀。

示例如下所示:

 
\documentclass[12pt]{article}
\begin{document}
    \textit{learnfk is a tutorial network for programmers technology including   \emph{hexagon} PHP, Java, Latex, Linux \emph{tutorials}.}
\end{document}

下圖顯示了以上代碼的輸出:

Latex Fonts Size and Styles

您可以看到使用\emph 命令的單詞與其他單詞之間的區別。

在另一個示例中,我們使用粗體代替了上面的斜體,如下所示:

 
\documentclass[12pt]{article}
\begin{document}
    \textbf{learnfk is a tutorial network for programmers technology including   \emph{hexagon} PHP, Java, Latex, Linux \emph{tutorials}.}
\end{document}

上面的代碼的輸出如下圖所示:

Latex Fonts Size and Styles

Latex文檔

它包括開始和結束時使用的基本命令。它還包括編寫文本的過程。在此模塊中,我們使用了 OVERLEAF 編寫代碼。Latex的概述如下:

 
\documentclass[a5paper, 12pt]{article}
\begin{document}
   LearnFk is a Tutorial network for programmers technology introduction, including PHP, Java, Latex, Linux and other related tutorials
\end{document}

上述文檔文件的輸出將是:

Latex Fonts Size and Styles

下面給出了常用的其他命令,這些命令將在本項目中進一步實現。

  • flushright和flushleft   -  這些命令寫爲\begin {flushright} \begin {flushleft} 。這些用於使文本在文檔的左右對齊。
  • \noindent                        -  如果要在沒有 indent 的情況下開始任何段落或在不中斷的情況下繼續該段落,則使用此命令。

故障排除

在Latex中,如果文檔文件中有錯誤,那麼它將在編譯後在底部以紅色顯示所有錯誤。錯誤將得到詳細說明。

錯誤看起來將如下圖所示:

Latex Fonts Size and Styles

之後,轉到特定的行並刪除錯誤。保存文件,然後可以再次編譯。

其他字體樣式

其他使用的字體樣式和相應的代碼如下:

  • 如果您希望文檔的大小不同,則可以使用extsizes包。命令是\documentclass [10pt] {extarticle} \documentclass [14pt] {extreport} 
  • 您還可以使用其他樣式來設置文本樣式。代碼如下:
 
\documentclass[9pt]{extarticle}
\begin{document}
    This text can be arranged in a unique way as given below:\\\\
    {\fontsize{50}{60}\selectfont LearnFK}
    {\fontsize{5}{6}\selectfont TeX!}
    {\Huge LearnFK}{\tiny TeX!!!}
\end{document}

輸出如下所示:

Latex Fonts Size and Styles

\fontsize \selectfont 命令用於修改文本的大小。您可以根據要求設置尺寸。

字體家族

下面列出了常見的字體系列:

字體家族 Full Form
cmm Computer Modern Italic
cmsy Computer Modern Symbols
cmex Computer Modern Extensions
cmr Computer Modern Roman
cmss Computer Modern Sans
cmtt Computer Modern Typewriter
ptm Adobe Times
phv Adobe Helvetica
pcr Adobe Courier

下表列出了字體系列的粗細和粗細支持的標準:

sb  -  Semi Bold

ub  -  Ultra Bold

b     -  Bold

eb   -  Extra Bold

ul     -  Ultra Light

el     -  Extra Light

l       -  Light

sl     -  Semi Light

m     -  Medium(normal)

標準 完整格式 %百分比
uc Ultra Condensed 50%
ec Extra Condensed 62.5%
c Condensed 75%
sc Semi Condensed 87.5%
x Expanded 125%
ex Extra Expanded 150%
ux Ultra Expanded 200%
m Medium 100%
sx Semi Expanded 112.5%

 https://www.learnfk.com/latex/latex-fonts-size-and-styles.html

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章