- LaTeX formulas and drawing techniques
- The formula can basically be divided into
- Single formula single number
- Single formula numbered by row
- Single formula multiple subnumbers
- Single formula part subnumber
- piecewise formula
- Now give the respective codes
- Single formula single number
Formula 1: equation + aligned \begin{equation} \begin{aligned} a= &b + c\ b= &a + 2\ c= &b-3 \end{aligned} \end{equation}
- Single formula numbered by row
Formula 2:align \begin{align} a= &b + c\ b= &a + 2\ c= &b-3 \end{align}
- Single formula multiple subnumbers
Formula 3: subequations + align (subnumber the formula) \begin{subequations} \begin{align} a= &b + c\ b= &a + 2\ c= &b-3 \end{align} \end{subequations}
- Single formula part subnumber
Formula 4: subequations + align + nonumber (partial subequations do not need to be numbered) \begin{subequations} \begin{align} a= &b + c\ b= &a + 2\\ onumber\ c= &b-3 \end{align} \end{subequations}
- piecewise formula
Formula 5: subequations + align + cases (piecewise function) \begin{subequations} \begin{align} y= &\begin{cases} a &x>0\ b&x<0 \end{cases}\ f= &\begin{cases} c &x>0\ d&x<0 \end{cases} \end{align} \end{subequations}
- Why not use split
- Because split is for a single formula, although the micro-operation is as good as align, it is not standardized and inconvenient for latecomers to micro-operation. It is essentially the same as programmers writing comments.
- Complete code
\documentclass{article} \usepackage{fancyhdr} % Customize the header and footer styles of the page \usepackage{tocloft} % Command to control the style of the table of contents (including table of contents, table table of contents and illustration table of contents) \usepackage{titlesec} % Customize title styles, such as chapter titles, section titles, etc. \usepackage{lipsum} % generate dummy text \usepackage{biblatex} % Manage and generate reference lists \usepackage{appendix} % Generate appendix part \usepackage{listings} % typeset source code blocks \usepackage{geometry} % Set page layout \usepackage{graphicx} % Insert images and arrange them \usepackage{subcaption} % sub-image \usepackage{amsmath} % matrix can be wrapped \usepackage{times} % Use times new roman font \usepackage{xeCJK} \setCJKmonofont{imitation Song} \\ umberwithin{equation}{section}% formula numbered by section \\ umberwithin{figure}{section}% Figures are numbered by chapter % Set directory format \renewcommand{\cfttoctitlefont}{\fontsize{15}{6}\\ ormalfont} % Change the table of contents title font \renewcommand{\cftsecfont}{\fontsize{15}{6}\\ ormalfont} % Set the chapter title font \renewcommand{\cftsubsecfont}{\fontsize{15}{6}\\ ormalfont} % Set subsection title font \setlength{\cftbeforesecskip}{2em} % Set the vertical distance between chapters \setlength{\cftbeforesubsecskip}{1em} % Set the vertical distance between subsections % Set page layout \geometry{ left=3cm, right=3cm, top=3cm, bottom=2cm, } % Set code layout \lstset{ language=Python, numbers=left, frame=single, breaklines=true, breakatwhitespace=false, basicstyle=\small\ttfamily, showspaces=false, % show spaces } % Set header and footer \pagestyle{fancy} \fancyhf{} \fancyhead[L]{Small article template} \fancyhead[C]{Made by Qian Ruiwen} \fancyhead[R]{\thepage} \renewcommand{\headrulewidth}{0.4pt} \titleformat{\section}{\fontsize{15}{6}\bfseries\itshape}{\thesection}{1em}{} \titleformat{\subsection}{\fontsize{15}{6}\bfseries}{\thesubsection}{1em}{} \begin{document} \t \thispagestyle{fancy} \pagenumbering{gobble} \begin{center} \textbf{<!-- -->{\fontsize{15}{14}\itshape\selectfont LaTeX small article template }} \vspace{2em} \t\t \textbf{<!-- -->{\fontsize{15}{14}\itshape\selectfont \today{} }} \vspace{2em} \t\t \end{center} \t \pagenumbering{arabic} % Start of text page \t \section{Formula editing skills} \quad \t Formula 1: equation + aligned \begin{equation} \begin{aligned} a= &b + c\ b= &a + 2\ c= &b-3 \end{aligned} \end{equation} Formula 2: align \begin{align} a= &b + c\ b= &a + 2\ c= &b-3 \end{align} Formula 3: subequations + align (subnumber the formula) \begin{subequations} \begin{align} a= &b + c\ b= &a + 2\ c= &b-3 \end{align} \end{subequations} Formula 4: subequations + align + nonumber (partial subequations do not need to be numbered) \begin{subequations} \begin{align} a= &b + c\ b= &a + 2\\ onumber\ c= &b-3 \end{align} \end{subequations} Formula 5: subequations + align + cases (piecewise function) \begin{subequations} \begin{align} y= &\begin{cases} a &x>0\ b&x<0 \end{cases}\ f= &\begin{cases} c &x>0\ d&x<0 \end{cases} \end{align} \end{subequations} \begin{thebibliography}{9} \bibitem{ref1} Author A. Title of the paper. Journal name, year. \bibitem{ref2} Author B. Title of the book. Publisher, year. \end{thebibliography} \t \t \t % appendix page \\ ewpage \appendix % marks the following parts as appendices \section*{Appendix} This is the content of the appendix. \begin{lstlisting} # Python example def hello_world(): print("Hello, World!") print("Hello, World!","Hello, World!","Hello, World!","Hello, World!","Hello, World!","Hello , World!","Hello, World!","Hello, World!","Hello, World!","Hello, World!","Hello, World!" ,"Hello, World!") hello_world() # call hello_world \end{lstlisting} \t \end{document}
- achieve effect
LaTeX table drawing skills
- Tables can basically be divided into
- three-wire meter
- Commonly used tables
- Adjust wireframe
- Adjust alignment
- c,l,r
- Only tabular cannot generate captions
- No alignment is set here
Table 1: Three-line table (without using table environment): \begin{center} \begin{tabular}{ccc} \toprule Header 1 & Header 2 & Header 3 \ \midrule Data 1 & Data 2 & Data 3 \ Data 4 & Data 5 & Data 6 \ \bottomrule \end{tabular} \end{center} Table 2: Three-line table (using table environment) \t \begin{table} \caption{Three-line table} \begin{center} \begin{tabular}{ccc} \toprule Header 1 & Header 2 & Header 3 \ \midrule Data 1 & Data 2 & Data 3 \ Data 4 & Data 5 & Data 6 \ \bottomrule \end{tabular} \end{center} \end{table}
- Adjusting the table is too complicated. I can only do two operations, which I think are enough.
- Do not seek to determine the width of each column, only require alignment
- Note that automatic line wrapping cannot be achieved in this way, so you need to be careful
- Pursue the width of each column, but the alignment is always left-aligned
- Do not seek to determine the width of each column, only require alignment
- Form 3:
\begin{tabular}{clr} \hline $a_b$ & amp; $a_b + c_d + e_f + g_h$ & amp; $m_n$ \ \hline $a_b + c_d + e_f + g_h + m_n-k_j$ & Data 2 & Data 3 \ Data 4 & Data 5 & $1 + 2 + 3 + a_b + c_d + e_f + g_h + m_n-k_j + 5 + 6 + 7$ \ \hline \end{tabular}
- Form 4:
\begin{tabular}{p{2cm}p{4cm}p{6cm}} \hline $a_b$ & amp; $a_b + c_d + e_f + g_h$ & amp; $m_n$ \ \hline $a_b + c_d + e_f + g_h + m_n-k_j$ & Data 2 & Data 3 \ Data 4 & Data 5 & $1 + 2 + 3 + a_b + c_d + e_f + g_h + m_n-k_j + 5 + 6 + 7$ \ \hline \end{tabular}
The knowledge points of the article match the official knowledge files, and you can further learn related knowledge. Algorithm skill tree Home page Overview 56589 people are learning the system