Quick Start
- Compiler: TeX Live + TexStudio, Ctex, Online: Overleaf
- The first sample code:
\documentclass{article} % Set the document class used by the document% Introduction area\title {my first Latex document}\author{Jclian91}\date{\today}\begin{document}% text area\maketitle hello, Latex!\end{document}
- Latex The command starts with \ and is case sensitive
- \documentclss command, the following parameters are:
- \documentclss{article}: Article Format, commonly used technical papers, reports, explanatory documents
- \documentclss{report}: long report, often used in reviews, long papers, simple books
- \documentclss {book}: Book, including chapter structure and preface, body, postscript
- \documentclss{proc}: A simple academic document template based on the article document class< /li>
- \documentclss{slides}: Slides, using sans serif font
- \documentclss{minimal}: extremely simple document class, used as a minimal working example for code testing
- Chinese version, such as ctexrep, Chinese version of report; ctexbook, Chinese version of book; ctexbeamer, Chinese version of beamer, used for slide presentation
- Latex parameters can be divided into mandatory parameters ({}), optional parameters ([]), special optional parameters (* ).
- Latex source code is divided intoIntroduction and text area:
- Introduction area: used for Global settings, or use the \usepackage command to call the macro package
- Text area: between \begin{document} and \end{document}, there can only be one document environment span>
- Comment: single line %; multi-line \iffalse … \fi or call verbatim package, use \begin{comment}…\end{comment} span>
- \section: chapter, \subsection: subsection, \par: subsection
text application
- English font settings include: font type, font weight, font shape, font size
- font type span>
- Roman: \rmfamily or \textrm{…}
- Sans serif font: \sffamily or \textsf{…}
- Monospace font: \ttfamily or \texttt{…}
- Font weight
- < li data-track="28">normal weight (medium ): \mdseries or \textmd{…}
- Bold: \cfseries or \textbf{…}
- font shape
- Upright solid: \upshape or \textup{…}
- Italian italic: \itshape or \textit{…}
- Italic: \slshape or \textsl{…}
- < span style="color: #3E3E3E; --tt-darkmode-color: #A3A3A3;">Small caps: \scshape or \textsc{…}
- font size
- \tiny: tiny font size
- \scriptsize: very small font size
- \footnotesize : fairly small font size
- \small: Small font size
- \normalsize: Normal size font size
- \large: large font size< /span>
- \Large: Larger font size
- \LARGE: very large font size
- \huge: huge font size
- \Huge: largest font size
You can also use the fancyhdr macro package to modify the content in the header and footer . Example Code: Set the middle of the footer to the bold page number; the right side of the header to the bold chapter name, and then draw a horizontal line with a width of 0.4pt in the header Line; draw a horizontal line with a width of 0.1pt in the footer. The enumitem macro package is used to set the spacing of list items. The list style can be set by code, such as $\ast$ means *. Two tabulation environments, array and tabular.
< ol start="8">style application
\markright{<right-mark>}\markboth{<left-mark>}{<right-mark>}
\usepackage{fancyhdr}\pagestyle{fancy}\fancyfoot[C]{\cfseries\thepage}\fancyhead[R]{\cfseries\leftmark}\renewcommand{\headrulewidth}{0.4pt}\renewcommand {\footrulewidth}{0.1pt}
Lists and tables
< pre>\beign{itemize} \item ... \item ... ...\end{itemize}
\beign{enumerate} \item ... \item ... ...\end{enumerate}
< code>\beign{description} \item ... \item ... \end{description}
\begin{array}{table position}{column style} \end{array}
pre>\begin{tabular}{table position}{column style} \end{tabular}\begin{tabular* }{total width of table}{table position}{column style} \end{tabular*}
\begin{tabular}{|l|c|c|c|r|} \hline Name& Chinese& Mathematics& English& Remarks\\ \hline Zhou Ping& 97 & 96 & 95 & Excellent\\ \hline Li Hong& 86 & 89 & 91 & Excellent\\ \hline Zhang Liang& 78 & 75 & 68 & Pass\\ \hline Li Rui& 53 & 59 & 64 & Fail\\ \hline Zhang Ke& 85 & 73 & 68 & Medium\\ \hline \end{tabular}
< p data-track="124">color system There are two kinds of rgb and gray. If it is gray, the color name is numerical; if it is rgb, the color name is red, yellow, etc. \rowcolor[color system]{color name}[left extension][right extension ]\columncolor[color system]{color name}[left extension][right extension]\cellcolor[color system]{color name}[left extension][right extension]
- Header with slash: diagbox macro package
Image Apply
Call the graphicx macro package first.
- Load image format: EPS, PDF, PNG, BMP, JPEG.
- The folder where the image is loaded: \graphicspath{{myimages/}}, myimages is a file The folder name should be placed in the same location as the Latex program source file, and two curly braces should be added outside the folder name.
- Load graphics: \includegraphics{<options>}{<filename>}
- Graphic and text mixing: wrapfig macro package, picinpar macro package
- Image watermark: eso-pic macro package
Mathematical formula (core function)
- < span style="background-color: #F8F8F8; --tt-darkmode-bgcolor: #191919;">Inline formula: …$, Interline formula: equation environment (the number will be automatically generated, this number can be used\ label command and \ref command to generate cross-references), displaymath environment (not numbered), or surround formulas with '\[formula\]' (not numbered)
- In mathematical formula mode: spaces are ignored, to change the spacing, use \quad or \qquad; blank lines or paragraphs are not allowed
- Superscript: ^, Subscript: _, Inequality: \ne, \neq, \not=, Ellipsis: \cdots(center ),\dots(down) ,
- Greek letters: \ + English name, such as \alpha, \beta, call amssymb or amsmath macro package
- fraction: \frac{ Numerator}{denominator}, the fraction will be compressed in the line, if you need to display the normal size fraction in the line, use dfrac{numerator}{denominator}; root formula: \sqrt{…} square root, nth root \sqrt[n ]{…}
- Operator: Multiply \times, divide \div, dot multiplication: \cdot, plus and minus sign: \pm or \mp, …
- relational symbol: no Equal to, greater than or equal to: \ge, less than or equal to: \le, approximately equal to: \approx, equal to: \equiv, …
- Mathematical functions: \sin, \cos, \tan, \log, \lim, \min, \sup, …
- Derivation and integral: \sum (accumulation), \prd (multiplication), \int (integration), \iint (double integral), '(derivative ), ...
- accent and arrow: vector arrow\vec{r}, left arrow\ leftarrow, right arrow\rightarrow, vector arrow\overrightarrow, …
- delimiter: | Equivalent to \vert, [equivalent to \lbrack, up arrow: uparrow, …
- Matrix: matrix environment
- Multi-line formula: gather environment, equal sign alignment: align Environment, line length formula: multline environment
- Theorem: \newtheorem{<theorem environment> ;}{<title>}[<section-level>] or \newtheorem{<theorem environment>}[<counter>]{<title>}, <counter> parameters cannot be combined with <section- Level> parameters are used together. A proof symbol is automatically added at the end of the proof environment.
References
- Use thebibliography environment, each reference starts with the \bibitem command
- The emergence of BibTeX frees users from the trouble of handwriting reference entries. BibTeX has a .bib extension, and its content is several reference entries. Each reference The grammar format of a document entry is as follows:
@<type>{ <citation>, <key1>={<value1>}, <key2> ;={<value2>}, ...}
Where, is the document Category, is the document label used by the \cite command. After <citation>, it is each field in the entry, organized in the form of <key>={<value>}
- Cite references in BibTeX: first use \bibliographystyle{<bst in the introduction area The -name>} command sets the reference style, for example, bst-name can be ieeetr, acm, etc.; finally, at the position where references need to be listed, quote the \bibliography command instead of thebibliography environment. The command syntax is as follows:
\bibliography{<bib-name>}
where bib-name is the file name in the BibTeX database.
- Citing reference techniques:
slideshow
- documentclass is beamer, Chinese version For ctexbeamer; creating a slideshow requires a frame environment
- Slideshow style: call the \usetheme command, For example, \uestheme{AnnArbor} calls the AnnArbor style slideshow
- slide content: A slide is one frame; the home page generally displays the title, author, date, etc.; you can use \section, \subsection, etc.; use the \tableofcontents command to generate a table of contents after the slide is divided into sections
- Dynamic presentation: \pause, \onslide, \only commands
Custom command
- Custom command:
\newcommand{\<name>}[<num>]{<definition>}< /code>
\<name> is the name of the command to be customized, used to set the custom For a new command, the maximum number of required parameters is 9, and the default value is 0, which is the specific definition of the new command. Here's an example:
\newcommand{\mynew}{I am a custom new command! } \newcommand{\mynewpp}[2]{#1 Favorite programming language is: #2} \mynew \par \mynewpp{Zhang Liang}{Java} \par \mynewpp{Li Hong}{Python}
The output result is:
I am customizing a new command! Zhang Liang's favorite programming language is: Java Li Hong's favorite programming language is: Python
- Renew Command
\renewcommand{\<name>}[<num>]{<definition>}
Modify the existing command, redefining the command modifies the operation of the original command, but Still applies to the environment of the original command.
- Customize and redefine the environment
\newenvironment{<name>}[<num>]{<before>|<after>}
< span style="letter-spacing: 1.5px;"><name> is the name of the custom environment, <num> is the number of parameters of the new custom environment, <before> is defined before the environment, a required parameter , <after> is defined after the environment, a mandatory parameter.
Sample code
- Sample PDF document
article example Code:
\documentclass{ctexart} % Set the document class used by the document% Set the page margin\usepackage[left=1in,right=1in,top=1in,bottom=1in]{geometry}% Set the header page foot \usepackage{fancyhdr}\pagestyle{fancy}\fancyfoot[C]{\cfseries\thepage}\fancyhead[R]{\cfseries\leftmark}\renewcommand{\headrulewidth}{0.4pt}\renewcommand{\footrulewidth}{ 0.1pt}% Introduction area\title{Secondary School Mathematics Formula Handbook}\author{Zhang Kejia}\date{\today}\begin{document}% Text Area\maketitle \newpage \tableofcontents \section{Secondary School Algebraic Formula} \subsection{Ratio Formula} \subsection{Fraction Formula} \subsection{Factorization Formula} \subsection{Formula for the Solution of a System of Equations} \subsection{Determinant Formula} \subsection{Exponent Formula} \subsection{Logarithmic Formula} \newpage \ section{Secondary geometry formula} \subsection{Triangle area formula} \subsection{Quadrilateral area formula} \subsection{Regular polygon area formula} \subsection{Circle formula} \subsection{Cylindrical formula} \subsection{Conic formula} \newpage \section {Plane trigonometric formula} \subsection{Relationship between radians and degrees} \subsection{Definition formula of trigonometric function} \subsection{Trigonometric function formula}\end{document}
- Example Slideshow
Slideshow sample code:
\documentclass{ctexbeamer} % Set the document class used by the document% Introduction area \usetheme{Goettingen}\usecolortheme{beaver}\title{Exploration of the Pythagorean Theorem}\subtitle{Proof and simplicity of the Pythagorean Theorem Application}\author{Li Hongli, Zhang Kejia}\institute{Qingdao Middle School Classroom}\date{\today}\begin{document}% text area\begin{frame} \maketitle\end{frame}\section{directory} \begin{ frame} \frametitle{Category} \tableofcontents \end{frame} \section{A brief history of the Pythagorean theorem} \subsection{A brief history of the Pythagorean theorem in China} \begin{frame} \end{frame} \subsection{tick A Brief History of the Pythagorean Theorem in Foreign Countries} \begin{frame} \end{frame} \section{Definition of the Pythagorean Theorem} \begin{frame} \end{frame} \section{Proof of the Pythagorean Theorem} \begin{frame } \end{frame} \section{Pythagorean number} \begin{frame} \end{frame} \section{Significance of Pythagorean Theorem} \begin{frame} \end{frame}\end{document}
- Reference Sample Code < /ol>
- Learn LaTeX in 30 minutes, https://www.overleaf.com/learn/latex/Learn_LaTeX_in_30_minutes
- Zhou Feng, Introduction and Practical Application of LaTeX[B]
- Beamer style reference website, Mechanical Industry Press https://mpetroff.net/files/beamer-theme-matrix/
Reference sample code:
\documentclass{ctexart} % set the document class used by the document \begin{document}% text area \begin{thebibliography}{99} \bibitem{myart1} Liu Guojun, Chen Shaoye. Library Catalog[M] . Beijing: Higher Education Press, 1957. \bibitem{myart2} Li Xiaobo, Wang Zheng. Library Catalog[M]. Beijing: Railway Press, 2015. \bibitem{myart3} Zhou Feng, Zhou Junqing. Library Catalog[M] ]. \emph{Beijing: Electronic Industry Press}, 2018. \bibitem{myart4} Gill, R.Mastring English Literatur[M], London: Macmillan, 1985.\end{thebibliography}\end{document}
BibTex code:
@book{mybook1, title={Visual Bisc}, authoe={Jack}, year={2005}, month={6}, publisher={Electronics Industry Press}, address={Beijing} }
References
Articles are uploaded by users and are for non-commercial browsing only. Posted by: Lomu, please indicate the source: https://www.daogebangong.com/en/articles/detail/Latex%20study%20notes.html
评论列表(196条)
测试