[Latex下載]
latex需要兩個軟件,一個純文檔編輯器,一個編譯器,分別是:
Textmaker(下載鏈接:http://www.xm1math.net/texmaker/download.html)
MikTex(下載鏈接:https://miktex.en.softonic.com/)
打包鏈接:鏈接:https://pan.baidu.com/s/1dG1fUz3 密碼:n0nm
(只適合win7)
其他組合:
texlive(https://tug.org/texlive/
http://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/Images/texlive2017-20170524.iso)
winedt(http://www.winedt.com/)
聽我同學說,這兩個用得比較多
[latex參考文檔]
推薦:https://www.latex-tutorial.com/tutorials/figures/
latex入門(劉海洋編著)
正確寫作美國大學生數學建模競賽論文
[Latex使用]
TextMaker裏編輯,再將文件在MikTex中打開編譯生成pdf版本
example code:
latex指令格式爲\作爲標識符,後面是指令,{ }裏面是參數。
documentclass聲明文章類型爲article,寫論文應該用這個選項。
[12pt]表明要求以12pt大小的字體輸出,如果不包含此選項,則以默認的10pt大小輸出.
\documentclass{article}這中間是引子部分,需要引用的包都需要申明。
\begin{document}
\documentclass{article}
\author{drunkprogrammer}
\title{Example}
\begin{document}
\maketitle
\end{document}
[latex更多指令]
\ldots
輸出: ...
\textbf{ }
{ }裏爲需要加粗的內容
\begin{ }
\end{ }
這是環境指令,{ }中可以設置環境,例如center,則begin和end中的文本會居中顯示
\\
換行
\textbackslash
輸出: \
\#
輸出: #
\{
\}
輸出: { }\^{}
輸出: ^
\%
輸出: %
\$
輸出:$
$\sim$
輸出: ~
$A \in B $
輸出: A
``hello"
輸出:“hello”
(左引號是按了兩次 ''tab鍵'' 上面的那個鍵,相當於中文的頓號的那個鍵 : ` 。右引號則是雙引號那個鍵)
`hello'
輸出:'hello’
(單引號也是按一次有頓號符號的那個鍵,和一次雙引號鍵)
\textit{}
{}裏面爲斜體內容
$$\sum_{k=1}^n k=\frac{n(n+1)}{2}$$
輸出:
(需在引子部分申明需要引用包:
\usepackage{amsmath,amssymb}
兩個$$符號之間輸入表達式)
$x$
輸出:數學變量x
(任何數學變量都應該在數學模式下輸入,$ $表示行內數學模式)
$\mathbf{x}$
輸出:黑體加粗數學變量X
$f(x)$
輸出:f(x)
(函數名需要斜體, sin(x)和log(x)需要用正體)
$\sin(x)$
輸出: sin(x)
$90^\circ$
輸出:
(\circ表示輸出角度)
^
表示上標
_
表示下標:_
(
$a_23$ 表示下底爲2
$a_{23}$ 表示下底爲23
)$2/3$
輸出:2/3
$\frac{2}{3}$
輸出:
$\binom{top}{bottom}$
例子:$\binom{2}{6}$
輸出行列式
\begin{equation}
\label{eqn}
x=2
\end{equation}
引用表達式x=2輸出:
\eqref{eqn}
引用上述表達式
\begin{align*}
a&=b+c\\
c&=d\\
e&=f
\end{align*}
{align*}環境下所有表達式都沒有編號,在=前面加上&可以等式對齊,\\表示換行
\begin{align}
a&=b+c\\
c&=d\\
e&=f
\end{align}
{align}環境下所有表達式都有編號{align*}和{align}兩者區別:
在align環境下,如果某個表達式不需要標號,則使用\nonumber
\begin{align}
a&=b+c\\
c&=d\nonumber \\
e&=f
\end{align}
輸出:\begin{equation*}
\begin{matrix}
1 & 2 \\
23 & 4 \\
\end{matrix}
\end{equation*}
輸出: 1 223 4
{matrix}表示矩陣環境,同一行的各個數據用&分隔開。
\begin{equation*}
\begin{pmatrix}
1 & 2\\
3 & 4
\end{pmatrix}
\end{equation*}
用圓括號包括的矩陣:\begin{equation*}
\begin{bmatrix}
1 & 2\\
3 & 4
\end{bmatrix}
\end{equation*}
用方括號包括的矩陣:\begin{equation*}
\begin{vmatrix}
1 & 2\\
3 & 4
\end{vmatrix}
\end{equation*}
用豎線包括的矩陣:【頁眉】
MCM需要指定形式的頁眉,即每頁左上角打印小組的控制編號,右上角打印本頁的頁碼和論文的總頁碼。
在引子部分插入頁眉
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{lastpage}
\lhead{Team \# 控制號}
\rhead{Page \thepage{} of \pageref{LastPage}}
\cfoot{}
輸出:
(
\renewcommand{\headrulewidth}{0pt}
不需要下劃線則在引子部分加入這個命令。
)
\section{introduction}
\subsection{what is introduction}
分節和分小節:\tableofcontents
在需要生成目錄的地方前面輸入這個命令,編譯後即可自動生成目錄。
例如:
(
\tableofcontents
\section{introduction}
\subsection{what is introduction}
腳註一般位於頁面的底部,可以作爲文檔某處內容的註釋。
\footnote{this is drunkprogrammer}
輸出:
\begin{itemize}
\item first element
\item second element
\item third element
\end{itemize}
列表的每個元素都要在前面加上item
輸出:
\begin{enumerate}
\item first element
\item second element
\item third element
\end{enumerate}
列表中有編號:
例如:
\begin{enumerate}
\item first element
\begin{enumerate}
\item first1 element
\item first1 element
\item first1 element
\end{enumerate}
\item second element
\item third element
\end{enumerate}
列表的嵌套,直接嵌套enumerate.
輸出:
在引子部分加入
\usepackage[pdftex]{graphicx}
然後用
\includegraphics[]{}
指令引用圖片,例如:
\includegraphics{data.png}
支持jpg,png,pdf格式的圖片。
例如:
(如果需要設置圖片大小則可以設置成:
\includegraphics[scale=0.5]{data.png}這就是將圖片設置爲原圖的0.5倍
\includegraphics[width=1cm]{data.png}
這就是將圖片設置爲原圖的0.5倍
\includegraphics[height=1cm]{data.png}
這就是將圖片的高設置爲1cm
\includegraphics[width=1cm]{data.png}這就是將圖片的寬設置爲1cm
)
\begin{figure}
\centering
\includegraphics[scale=1]{data.png}
\caption{This is data structure and alogrithm picture}
\end{figure}
輸出:
(\caption{}添加描述,\centering讓圖片居中,\begin{figure}表示在figure環境下)
Reference: Figure \ref{figure1} .
\begin{figure}
\centering
\includegraphics[scale=1]{data.png}
\caption{this is data structure and alogrithm picture}
\label{figure1}
\end{figure}(
\label{figure1}
給圖片增加標籤。
Figure \ref{figure1}引用圖片 )
\begin{tabular}{|c|lr|}
\hline
drink & tea & milktea\\
\hline
coffee & red & banana\\
\hline
\end{tabular}
輸出:
(tabular是表示表格環境,
c表示列元素居中
l表示列元素左對齊
r表示列元素右對齊
\hline表示加根下劃線
)
\begin{tabular}{|c|l|r|}
\hline
drink & \multicolumn{2}{c|}{milktea} \\
\hline
coffee & red & banana\\
\hline
coffee & red & banana\\
\hline
\end{tabular}\\
輸出:(\multicolumn{2}{c|}{milktea}
將一行分倆列
\multirow{2}{c|r}{milktea}
將一列分倆行
)
\begin{thebibliography}{99}
\bibitem{book}
Kui,Si. \textsl{Mathmatical Modeling Algorithms and Application.}
\end{thebibliography}
輸出:(
\begin{thebibliography}{99}
\end{thebibliography}
引用參考文獻所需要的環境
\bibitem{book}
每個文獻以\bibitem{}開頭
作者可以在論文中通過\cite{}來引用文獻
例如:
we use this page \cite{book}
)
【附錄】
上述所有命令的示例代碼
\documentclass{article}
\author{drunkprogrammer}
\title{Example}
\usepackage{amsmath,amssymb}
\usepackage[pdftex]{graphicx}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{lastpage}
\lhead{Team \# 74901}
\rhead{Page \thepage{} of \pageref{LastPage}}
\cfoot{}
%\renewcommand{\headrulewidth}{0pt}
\begin{document}
\maketitle
\textbf{content}
1,2,\ldots,5
\begin{center}
1,2,\ldots,5
\end{center}
\textbf{content}\\
1,2,\ldots,5
\textbackslash
\#
\{
\}
\^{}
\%
\$
$\sim$
``hello"
‘hello'
\textit{drunkprogrammer}\\
$$\sum_{k=1}^n k=\frac{n(n+1)}{2}$$
$x$
$\mathbf{x}$
$f(x)$
$\sin(x)$
$90^\circ$
$a_23$
$a_{23}$
$2/3$
$\frac{2}{3}$
$\binom{2}{6}$
\\
\begin{equation}
\label{eqn1}
x=2
\end{equation}
Reference:\eqref{eqn1}
\begin{equation}
\label{eqn}
x=3
\end{equation}
Reference:\eqref{eqn}
\begin{align*}
a&=b+c\\
c&=d\\
e&=f
\end{align*}
\begin{align}
a&=b+c\\
c&=d\\
e&=f
\end{align}
\begin{align}
a&=b+c\\
c&=d\nonumber \\
e&=f
\end{align}
\begin{equation*}
\begin{matrix}
1 & 2 \\
23 & 4 \\
\end{matrix}
\end{equation*}
$A \in B $
\begin{equation*}
\begin{pmatrix}
1 & 2\\
3 & 4
\end{pmatrix}
\end{equation*}
\begin{equation*}
\begin{bmatrix}
1 & 2\\
3 & 4
\end{bmatrix}
\end{equation*}
\begin{equation*}
\begin{vmatrix}
1 & 2\\
3 & 4
\end{vmatrix}
\end{equation*}
\tableofcontents
\section{introduction}
\subsection{what is introduction}
article
\footnote{this is drunkprogrammer}
\begin{itemize}
\item first element
\item second element
\item third element
\end{itemize}
\begin{enumerate}
\item first element
\item second element
\item third element
\end{enumerate}
\begin{enumerate}
\item first element
\begin{enumerate}
\item first1 element
\item first1 element
\item first1 element
\end{enumerate}
\item second element
\item third element
\end{enumerate}
\includegraphics{data.png}
\includegraphics[scale=0.5]{data.png}
\includegraphics[width=1cm]{data.png}
\includegraphics[height=1cm]{data.png}\\
Reference: Figure \ref{figure1} .
\begin{figure}
\centering
\includegraphics[scale=1]{data.png}
\caption{this is data structure and alogrithm picture}
\label{figure1}
\end{figure}
\begin{tabular}{|c|lr|}
\hline
drink & tea & milktea\\
\hline
coffee & red & banana\\
coffee & red & banana\\
\hline
\end{tabular}\\
\begin{tabular}{|c|l|r|}
\hline
drink & \multicolumn{2}{c|}{milktea} \\
\hline
coffee & red & banana \\
\hline
coffee & red & banana\\
\hline
\end{tabular}\\
\begin{tabular}{|c|l|r|}
\hline
drink & milktea \\
\hline
coffee & red & banana\\
coffee & red & banana\\
\hline
\end{tabular}\\
\begin{tabular}{c|r}
\hline
$\alpha$ & $\#$ \\
\hline
$\alpha$ & $\#$ \\
\hline
\end{tabular}
\begin{thebibliography}{99}
\bibitem{book}
Kui,Si. \textsl{Mathmatical Modeling Algorithms and Application}
\end{thebibliography}
we use this page \cite{book}
\end{document}