LaTex commonly used grammar

1. Basic grammar

1.1 subscript

In LaTeX using argmin, argmax time, the subject method is provided: \mathopas \ mathop {\ arg \ max} _ {\ theta}.

2. Official

1.1 binary relations
symbol grammar symbol grammar symbol grammar symbol grammar
< < > > = = \leq
`` `` `` ``
`` `` `` ``
`` `` `` ``
1.2 Fonts

The formula is the same font tilt: \rm. If you want the formula becomes a straight body portion, then to the portion enclosed by {}. Otherwise, the entire contents of the equation will become straight body.

Number of the formula

Using a simple alignenvironment. Of course, you can use an asterisk (*) to hide the variable number, and press \tagto set a specific mark.

\documentclass{article}
\usepackage{amsmath}
\usepackage{kantlipsum}
\usepackage{showframe}
\allowdisplaybreaks

\begin{document}
\kant[1-3]
\begin{align*}
    a\\
    b\\
    c\\
    d\\
    e\tag{\stepcounter{equation}\theequation}\\
    f\\
    g\\
    h\\
    i
\end{align*}
\end{document}

If you do not use an asterisk environment, it can be used \nonumberto specify which line formula is not assigned numbers as follows:

\begin{eqnarray}
	a\nonumber\\
	b\nonumber\\
	c\nonumber\\
	d\nonumber\\
	e\nonumber\\
	f
	\label{eqn:q}
\end{eqnarray}
Cross-page display multiple lines of formula

You can use \begingroupand \endgroupcommand amsmath in the local \allowdisplaybreakscommand interruption:

\begingroup
\allowdisplaybreaks
\begin{align}
    % some equations
    ....
\end{align}
\endgroup

3. Algorithms

latex algorithm associated with commonly has several packages, algorithm, , algorithmic, algorithmicx, algorithm2eit can be roughly divided into three categories, three or publishing environment. The most original is the use of algorithm+ algorithmic, this first appeared, the hardest to use, you need to define yourself some instructions. The second environment is a layout algorithm+ algorithmicx, algorithmicx provides some predefined macro definitions and good environment (layout), similar instructions algorithmic. The third is algorithm2e, only one package, use and programming of feel like, is what I prefer packages. Here is algorithm2ean example.

\documentclass[a4paper]{ctexart}
\usepackage[ruled]{algorithm2e}
% some others
\begin{document}
% some others
\begin{algorithm}
    %\SetAlgoRefName{} % no count number
    \caption{pISTA}
    \label{alg:pISTA}
    Parameters: $\lambda, \gamma$\;
    Initialization: $x_0$\;
    \While{not converge}{
        $x_{k+1}=\Psi^*T_{\lambda\gamma}(\Psi(x_k+\gamma \mathcal{F}^{-1}Q_p(y-Q_p \mathcal{F}x_k)))$\;
    }
\end{algorithm}
\end{document}

Simple explanation here, two vertical ruled lines show the algorithm represents the environment, this can try to remove the difference and not removed. The following \ SetAlgoRefName {} not display title (Caption) of Algorithm ID, i.e. the original Algorithm n:becomes Algorithm:. More instructions for use, you can directly access to official documents .

algorithm is floating, you can not put the box (e.g. tcolorbox) inside. If you need this look, use \begin{algorithm}[H], or appear LaTeX Error: Not in outer par mode error.

4. textbox

tcolorboxPackages are packages for drawing a colored text box. Examples are as follows:

\documentclass{article}
\usepackage{tcolorbox}
\tcbuselibrary{most}
\begin{document}
\begin{tcolorbox}[title = {My Box},
  fonttitle = \bfseries, fontupper = \sffamily, fontlower = \itshape]
  This is a \textbf{tcolorbox}.
  \tcblower
  This is the lower part.
\end{tcolorbox}
\end{document}

Here Insert Picture Description

LaTex Learning Resources

muzimuzhi/latex-examples [github]

Published 66 original articles · won praise 101 · views 30000 +

Guess you like

Origin blog.csdn.net/u010705932/article/details/104576524