Common operations and precautions for Latex writing

Common operating instructions and precautions for Latex writing

Page side play settings

\usepackage{geometry}

\geometry{a4paper,scale=0.8}

The above command sets the paper as a4 paper, and the ratio of the core to the page length is 80%; scale can also be changed to ratio, which means the ratio of the layout margin to the length of the page.

This package can also set the
top, bottom, left , and right margins of the page, for example: \geometry{a4paper,left=2cm,right=2cm,top=3cm,bottom=3cm}

unit used in latex

pt: A point is equivalent to 1/72.27inch, which is about 0.0138inch or 0.3515mm;

mm: millimeters; cm: centimeters; in: inches;

ex: approximately equal to the height of the letter x (lowercase) in the current font;

em: approximately equal to the width of the letter M (uppercase) in the current font;

mu: The currently used math font is the reference em, then 1mu=1/18em.

Common parameter description

  1. [c] is centered horizontally, [l] centered horizontally left, [r] centered horizontally right;
  2. *[c]horizontal + vertical center, *[l] vertical center + horizontal left center, *[r] vertical center + horizontal right center.
  3. There are two types of word wrapping in English: one is warp, which means that words will wrap in units of words. If they are left-aligned, some segments will appear jagged. The other is line break, which will be connected with "-" when the word wraps.

 

Common Functions

  1. If it is written in chapters, there must be no spaces in the chapter path file name.
  2. \noindent: Newline is not indented; \indent adds a space at the beginning of the paragraph.
  3. \hspace{2em}: Manually indent by 2em.
  4. The difference between \ref and \ref* is that the former will cross-reference, while the latter will only be used when you want to cite but don't want to create a reference link (from: URL ).
  5. For journal article templates, insert the appendix section (appendix): use the \usepackage{appendix} package (reference: URL ).
    \begin{subappendices}
    \subsection{How I became inspired}
    ...
    \end{subappendices}
  6. To insert an appendix chapter (when writing a dissertation), you can use the ​\usepackage[toc,page]{appendix} package (reference: URL ).

    \usepackage[toc,page]{appendix}
    ...
    \begin{appendices}
    ...
    \end{appendices}
  7. For the IEEE conference template to insert an appendix, just use \appendices. (Reference: URL )

    \appendices
    \section*{Appendix} \label{app:A}
    input text here.
  8. When there is no need to add packages and modify the environment, insert a blank line directly: \\ \hspace*{\fill} \\, or \hspace*{\fill} \\

  9.  

Font

Change font color

\usepackage{color}

1. {\color{red} text}

2. \textcolor[rgb]{1,0,0}{text} The color parameter range is [0,1]

 

form

Common parameter description of the table

p{width}: Top-aligned cells width fixed width

m{width}: Middle-aligned cells width fixed width

b{width}: Bottom-aligned cells with fixed width

 

Table operation

  1. The code of \renewcommand\arraystretch{2} is used to double the height of each row.
  2. \addlinespace This is used to add blank lines in the table.
  3. *It is equivalent to adding a \jot (about 3pt) to the vertical gap between the text and the upper and lower edges of the cell.
  4. If you want to align the top of a multi-row table (\multirow), you can do this \multirow [t] {2}{*}{XXX}, which means a table that spans two rows, and XXX is aligned at the top.
  5. If you want the text in the multi-row table (\multirow) to automatically wrap (warp), you can set the width instead of *, such as \multirow[t]{6}{ 3cm }{Design or structure defects}.
  6. If there is too much content in the table to manually wrap, call the \usepackage{makecell} package, and then in the cell to be wrap, \makecell[parameters: c,l,p,tl,tp,tc,...]{ {111 } \\ {222} \\ {333}}. Simple content can be directly used \makecell[parameters: c,l,p,tl,tp,tc,…]{11 \\ 22 \\ 33}, but complex content must be bracketed, ie { {222} \\ { 333}}.
  7. Set cell wrap . For example, if the table has two columns, you want the first column to be centered (c), and the second column to wrap automatically (you can wrap automatically when you limit the width, such as p{0.85 \textwidth } ), you can set it like this: \begin { tabular }{cp{0.85 \textwidth }}
\begin{table}[H]
    \footnotesize
    \centering
    \caption{Example of a Table}\label{T:Table}
    \begin{tabular}{cp{0.85\textwidth}}
    \toprule
    \textbf{No.} & \textbf{Question}\\
    \hline
    Q1 & Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question \\\hline
    Q2 & Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question \\\hline
   \multirow[t]{3}*{Q3} & Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question \\
   ~ & \textbf{A}. Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question \\
   ~ & \textbf{B}. Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question Question \\\bottomrule
    \end{tabular}
\end{table}

  8. Place the page horizontally (horizontal page), insert a horizontal table.

\usepackage{lscape}

\begin{document}

\begin{landscape}
This is a landscape page.

\end{landscape}

\end{document}

 9. The table width limit and center setting:

\begin{tabular}{|p{3cm}<{\centering}|p{4cm}|p{6cm}|}

10. Table cell width adjustment:

\usepackage{booktabs} %用到的包
\specialrule{0em}{1pt}{2pt} %0em表示单元格上方插入一根宽为0em的横线,因为宽度为0,所以相当于没有插入横线;紧跟着的俩个{1pt}分别表示单元格内容距离上方单元的距离为1pt和距离下方单元格的距离为2pt(可以根据自己的需求调整)。

11. 

Mathematical formula

font size:

Number seven 5.25pt 1.845mm \tiny
number six 7.875pt 2.768mm \scriptsize
small number five 9pt 3.163mm \footnotesize
number five 10.5pt 3.69mm \small
small number four 12pt 4.2175mm \normalsize
number four 13.75pt 4.83mm \large
number three 15.75pt 5.53mm \Large
No. 2 21pt 7.38mm \LARGE
No. 1 27.5pt 9.48mm \huge
small first 36pt 12.65mm \Huge
first 42pt 14.76mm 

How to use: replace small in the code below

\begin{small} 
\begin{equation} 
\ldots 公式,如:{
   
   {F}_{1}}-score=\frac{2\times precision\times recall}{precision+recall}
\end{equation} 
\end{small}

Mathematics Symbol

This website summarizes very comprehensively: http://mohu.org/info/symbols/symbols.htm

Reference related

1. When using Latex to typeset a paper, characters other than the first character of the title of the paper will appear in the reference section and converted to lowercase. For example, {ABCDEFG} will become {Abcdefg}. At this time, if you want to keep the original style of the title, you can Use curly braces to enclose the title, for example: { {ABCDEFG}}

2. When writing a journal article, if you want to change the capitalization of the title of the reference, you can start with the .cls file. Change the reference title from lowercase to uppercase REFERENCES.

 

other

The difference between \textwidth and linewidth

\textwidth \linewidth

\textwidth is the normal width of the text on a page. It should generally be changed only in the preamble.

 

\linewidth is the width of lines in the current environment. Normally equal to \textwidth, it may be different within an environment such as list or quote environments.

 

(Updated from time to time)

Guess you like

Origin blog.csdn.net/Ryan_lee9410/article/details/111873177