Write up front: Since you need to use TexStudio, gather tutorials on it. All records are from the Internet and are linked in the references section. LaTeX is what you think you get, Word is what you see. So you tell Latex what you want to do, and then it processes the commands you give it.
The usual framework:
% introduction area
\documentclass{article}
\usepackageMacro {package}\title{title}\author{the}\date{date}% the text area
\begin{document} % Start text
\tableofcontents % directory (may not exist)
\maketitle % Display title
\section{level 1 heading}\subsection{secondary headings}\subsubsection{level 3 title}\paragraph{} % paragraph
\par % indicates the end of the paragraph, usually at the end of the sentence
\newpage % start another page
\end{document} % End text
Copy the code
Matters needing attention:
- Symbols with subscripts need to keep the subscript straight (non-italic) :
, you can use{\rm ... }
Enclose the parts that need to be straight, as shown in the correct Latex expressionT_{\rm j}
- Bold text:
\textbf{text content}
[\bf{text content} can also be used in bold, but texStudio does not support this expression and will make all subsequent text bold.] - Italic text:
\ Textit {text content}
- Double quotation marks: ‘ ‘Text content”
- When the text is needed, pass
\noindent
Achieve the effect of text top - use
\ \hspace*{\fill} \par
You can barely get a blank line (better ones below)
Other:
\usepackage{indentfirst} % sets the indentation of the first line of a paragraph
\usepackage{setspace} % Package to call to modify line spacing
\usepackage[UTF8]{ctex} % Chinese supplementary package, placed under the format.
\thispagestyle{} % is used to generate the header footer format for the page, with four options; 1, empty: Set the header and footer to blank; 2, plain: display header footer; Keywords keywords: only the page header is displayed; 4, myheading: with \markboth or \markright command for user-defined.
\setcounter{page}{x} % Resets the page number to X.
\pagenumbering{} % Set the format of the page number, Arabic: Roman: Roman numeral; Alph: English letter. If you uppercase their initials, the number format will become uppercase.
\usepackage[a4paper,left=10mm,right=10mm,top=15mm,bottom=15mm]{geometry} % Set the page environment, A4 paper size, left and right upper and lower margin information
~\ \ % adds an empty line
Copy the code
It is necessary to say something about the line change.
-
The “hard newline” in Word (a downward arrow) is the same as the “\\” newline character in Latex, which means to wrap the text but still belong to the same paragraph
-
The “soft wrap” in Word (a turning arrow) is equivalent to the paragraph mark “\par” in Latex or to a blank line, meaning that the text that follows is another paragraph. Note, however, that multiple blank lines or consecutive \ pars will count as one
-
Latex doesn’t have parameters such as “before, after, and line spacing” like Word does. Typesetting can only be controlled by setting “paragraph spacing, line spacing”. You can also implement blank lines like the following:
\newline \vspace{2cm} \ \[2\baselikeskip] \vspace{2\baselineskip} % 2 times the current line spacing, which is adjusted with \linespread \vspace{\fill} % spacing to the bottom, the text below is equivalent to "bottom aligned" Copy the code
Abstract:
\begin{abstract} % Digest start
Your abstract.\ \ "\\" is placed at the end of a paragraph to indicate another line
% "\par" is at the beginning of the paragraph, indicating another line, "\textbf{}", with the contents in curly braces in bold
\par\textbf{Keywords: } Keyword1; Keyword2; Keyword3
\end{abstract} % End of digest
Copy the code
Formula:
\begin{equation} % "equation" indicates that the insert formula is automatically numbered
Latex's extensive syntax is used to express mathematical formulas and symbols
\end{equation}
\begin{align} % can be edited for multi-line formulas, with newlines implemented using "\\"
\end{align}
Copy the code
In the definition part, formula writing is most commonly used. For the definition description of a whole paragraph, as well as related properties, theorems and other contents, it is used
% Can be defined as follows in the introduction area (header) to customize parameter
\newtheorem{definition}{\bf\it Definition \quad}[section] % The first {} is parameter, the second {} is the display style, the third [] is the numbering, section means that each section is automatically numbered, the default is full text serial numbering
\usepackage{amsthm} % You must import this package if you want to use proof statements
\newtheorem*{parameter}{parameter} % indicates no number
\begin{parameter} % the parameter can be: definition, unseen/property/lemma/want/rationale commentContent...\end{parameter}
Copy the code
Form:
Three wire form
\usepackage{booktabs} % The package to call when inserting the table
\usepackage{diagbox} Insert table macro package
\usepackage{multirow} Insert multi - line table with macro package
\begin{table}[htb] % h: hear, t: top, B: bottom, P: page, next page
\setlength{\abovecaptionskip} {0.0 cm}% controls the table name top margin
\setlength{\belowcaptionskip} {0.2 cm}% controls the table name margin
\caption{table name}
\centering
\label{tab1}
\begin{tabular}{ccc} % c is center aligned and l is left aligned
% a few columns to write a few c, said the center content writing, where the need to line, where the "|"
\toprule
a & b & c \ \
\midrule
1 & 2 & 3 \ \
\bottomrule
\end{tabular}
\end{table}
Copy the code
Merge multi-row tables
\begin{table}
\caption{Multi}
\centering
\label{tab1}
\begin{tabular}{|c|c|c|c|c|}
\hline
\multirow{2} {x} {1}& 11 & 111 & 1111 & 11111 \ \
The first argument {2} specifies how many lines to span, {*} is mandatory, and {1} refers to the content to be filled in the merged cell. Then fill in a few lines, remembering to end each line with "\\".
\cline2-5} {% \cline{} means to add a dividing line between the columns, and {2-5} means to fill in the next 2-5 columns.
2 & 22 & 222 & 2222 & 22222 \ \
\hline
3 & 33 & 333 & 3333 & 33333 \ \
\hline
\end{tabular}
\end{table}
Copy the code
Supplement:
- Merge multiple columns by simply applying the expression
\multirow
to\multicolumn
Can be
Can branch the form
\newcommand{\tabincell} [2] {\begin{tabular}{@{}# 1@ {}}# 2\end{tabular}}
% table wraps automatically
\begin{table*}[ht] % h: hear, t: top, B: bottom, P: page, next page
\caption{Title}
\centering
\begin{tabular}{|c|c|c|}
\toprule
{\bf Method} & {\bf 1} & {\bf 2} \ \
% \bf indicates bold font
\hline
\tabincell{c}{01\ \02\ \03} & \tabincell{c}{11\ \12} & \tabincell{c}{21,\ \22} \ \
% use \tabincell{c}{fill in the first line \\ second line contents ··}, can be as needed, also does not limit the number of lines.
\hline
11 & \tabincell{c}{dsads\ \deawd} & \tabincell{c}{dewaf\ \cewaef} \ \
\bottomrule
\end{tabular}
\end{table*}
Copy the code
Table with slash
\begin{table}[ht] % h: hear, t: top, B: bottom, P: page, next page
\caption{example}
\centering
\begin{tabular}{|c|cc|}
\hline
\diagbox{bottom}{top} & A & B \ \
% slash command statement
\hline
1 & abc & def \ \
2 & ghijk & lmn \ \
3 & opq & rst \ \
\hline
\end{tabular}
\end{table}
Copy the code
Supplement:
-
To insert a hurdle table, you simply need to add an asterisk after the table attribute
% note that this is "table*" not "table" \begin{table*} ... \end{table*} Copy the code
-
You can add tables when they appear too large or too small in the text
\setlength{\tabcolsep}{7mm}{ \begin{tabular}{lll} ... \end{tabular}} Copy the code
-
You can add tables that are too wide or too narrow in the text
\resizebox{\textwidth}{7mm}{ \begin{tabular}{cc} ... \end{tabular}} Copy the code
Image:
\usepackage{graphicx} % The package to call when the image is inserted
\usepackage[subfigure]{graphfig} Insert multiple picture macro package
\begin{figure}
\centering % in the middle. It can also be left or right.
\includegraphics[height = 4.5 cm, width = 7.5 cm] {the SVM_model.pdf}
SVM_model is the name of the image to be inserted.
\caption{This is a SVM model.} % Picture description.
\label{Fig1} % The label used to reference the image.
\end{figure}
Copy the code
Supplement:
-
To insert a hurdle image, just add an asterisk after the figure property
% note that this is "figure*" not "figure" \begin{figure*} ... \end{figure*} Copy the code
-
We usually write papers to insert images in the format of “EPS, PDF, JPG”, these formats can be compiled by Matelab and saved as
-
When inserting eps files into latex, the following packages need to be imported
\usepackage{amsmath, amssymb, amsfonts, graphicx} \usepackage{epstopdf} Copy the code
-
-
The following are all custom Settings for images in latex
% Controls how far the image is from the previous line, in cm or pt \setlength{\abovecaptionskip}{0cm} % Controls how far the image is from the next line, in cm or pt \setlength{\belowcaptionskip}{-0.cm} % \scalebox{} indicates the scaling of the image. The parameter value "1" is the original size % trim={left, lower, right, upper} clipping the image, useful if the image has a white edge, in cm or pt % width indicates that the width of the image is set in cm or pt. In particular, the parameter "0.5\textwidth" can be set directly when writing a two-column paper so that the image does not take up the entire width % above height \scalebox{\includegraphics[trim={}, clip, width=, height=]Copy the code
-
Posted here is a link to instructions for using illustrations and colors in latex.
Algorithm:
Usually the framework
The algorithm is a floating block. Latex is designed to handle pseudocode blocks the same way it handles image tables.
% While Algorithmic is responsible for writing algorithms, controlling typography and other functions (can be replaced by Algorithmicx)
% --------- Import package used to write the algorithm -------------
\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage{amsmath}
\usepackage{xcolor}
% ---- redefines the key ---- corresponding to require and ensure
\renewcommand{\algorithmicrequire} {\textbf{Input:}} % Note that this only changes the display of REQUIRE, using \REQUIRE again
\renewcommand{\algorithmicensure} {\textbf{Output:}}
% --(the default Require/Ensure is defined as Input/Output)--
\begin{algorithm} % algorithm start
\caption{Sample algorithm} % algorithm
\label{alg1} % algorithm tag, which can be used as a reference flag
\begin{algorithmic}[1] Each sentence in the algorithm is preceded by a line number
\REQUIRE Text:Today is a good day. Variables:$u,v,w$. $G=(V,E)$ % Input criteria (the default keyword for REQUIRE is REQUIRE, which is defined as Input above)
\ENSURE Something... % Output result (ENSURE's default keyword here is ENSURE, which is custom Output above)
% if-then-else
\IF{some condition is true}
\STATE do some processing
\ELSIF{some other condition is true}
\STATE do some different processing
\ELSE
\STATE do the default actions
\ENDIF
% for loop
\FOR{$i=0$ to $10$}
\STATE carry out some processing
\ENDFOR
\FORALL{$i$ such that $0\leq i\leq 10$}
\STATE carry out some processing
\ENDFOR
% while-loop
\WHILE{some condition holds}
\STATE carry out some processing
\ENDWHILE
% repeat-until loop
\REPEAT
\STATE carry out some processing
\UNTIL{some condition is met}
% infinite loop
\LOOP
\STATE this processing will be repeated forever
\ENDLOOP
\RETURN return parameters
\end{algorithmic}
\end{algorithm}
Copy the code
The effect picture is as follows (quoted from netizen Ihoujie) :
Other:
In fact, macro package algorithmicx and macro package Algorithmic have the same effect, except that one keyword is capitalized only and one keyword is capitalized only
The difference in % Algorithicx is the ability to add some additional descriptions to pseudocode to make it easier to read
% --------- Import package used to write the algorithm -------------
\usepackage{algorithm}
\usepackage{algorithmicx}
\usepackage{algpseudocode} The % AlgPseudocode macro package, on the other hand, is part of the Algorithmicx macro package, which provides the environment for actually typeset pseudocode
\usepackage{amsmath}
\usepackage{xcolor}
\begin{algorithm}[htb]
\caption{sample algorithm}
\label{alg_label}
\begin{algorithmic}[1]
\Require input paramters
\Ensure output
\Procedure{function name}{paramters}
\State Balabalabala...
\Statex Balabalabala... % \Statex can be used to cancel line numbers when some pseudocode is too long to ensure typographical beauty
\EndProcedure
\Return result.
\end{algorithmic}
\end{algorithm}
Copy the code
More examples can be found here.
Be good with TexStudio’s spelling and grammar checker, which automatically corrects errors with a right click. Here is the user finishing the tutorial, can also be configured according to the need. [The version of the software I downloaded when USING it is not correct. There is a problem with the highlighting function, and I have not found a fix. Here is a formal download website (the original TexStudio website requires a ladder).]
Citation:
The suffix bib is recommended for document management citation
\usepackage{cite} Insert macro package of references
\cite{pa1} % references a single tag, such as [1]
\cite{pa1, pa2, pa3}% references multiple tags, such as [1, 2, 3]
The % plian parameter indicates a ranking of references
\bibliographystyle{plain}
% Insert reference splnCS04 as a. DST file, which is a template for a reference
\bibliographystyle{splncs04}
% XXX is a. Bib file, that is, a downloaded reference in the format of Bibtex
\bibliography{xxx}
Copy the code
If you have already generated a PDF file of a different style, you will get an error if you change the code and compile it directly. In this case, delete the cache files.aux and.bbl and compile again. Of course, other non-grammatical errors can also be solved by this method.
There are the following parameters for the presentation style of the reference :(pay attention to the format requirements of the recipient when submitting)
- Plain, in alphabetical order, by author, year, and title;
- Unsrt, in the same style as plain, is sorted by reference order;
- Alpha, in alphabetical order, marked with the first letter of the author + the last two digits of the year;
- Abbrv, similar to plain, will be shortened to the full spelling of the month, more compact;
- Ieeetr, International Institute of Electrical and Electronics Engineers Journal style;
- Acm, ACM Journal Style;
- Siam, Journal style of the American Society for Industrial and Applied Mathematics;
- Apalike, Journal style of the American Psychological Association;
Reference:
- Bloodbath Cream: Latex use, insert title…
- Ihoujie: Latex insertion algorithm
- Zhang Yigen: LaTeX learning series – a summary of LaTeX
- Crushed Gold: The Correct Posture for Entry to LaTeX Typography (Introduction to LaTeX Typography)
- Liam Huang: A very short introductory LaTeX document
- A Life without pet: A common way to illustrate and insert tables in LATEX
- Haiyang Liu: Introduction to LaTex
- LaTex Community: Community home page
- HzYang: [Open Source project] Quick Guide for LaTeX
- MOON: LaTex Handbook