\centerline
Syntax: centerline {text}
This is the original command of Tex for centering short text.
Center environment
Grammar:
\begin{center}
First line\\
The second line\\
\end{center}
Center environment can realize the alignment of multiple lines.
In the center environment, if the “first line” is too long, it will wrap automatically, and the text of the wrap is still center aligned, so this is a very common way.
example
Here is a very practical example. When writing a paper, you need to write a title, and it is usually stipulated that the title above is in Chinese and the title below is in English
one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen |
\documentclass[11pt,a4paper]{article} \usepackage{CJK} \usepackage{type1cm} \usepackage{times} \newcommand{\song}{\CJKfamily{song}} \newcommand{\xiaoer}{\fontsize{18pt}{18pt}\selectfont} \newcommand{\xiaosan}{\fontsize{15pt}{22pt}\selectfont} \Renewcommand {baselinestretch} {1.8}% double spacing \begin{document} \begin{CJK*}{GBK}{song} \begin{center} The shortest path algorithm: ~ classification system and research progress}} \ {Xiaoer shortest path algorithms: ~ taxonomy and advance in research}% Times New Roman, sophomore \end{center} \vspace{20pt} \Centerline {Xiaosan for Quad: Lu Feng}% can be used for shorter text \end{CJK*} \end{document} |
The results are as follows