LaTex作为编辑数学公式,撰写论文是一款极其有利的工具,具体看代码注释:
%:注释开始标志
\\ :换行
基本格式:
\document[article]
\begin{document}
...
\end{document}
\documentclass{article}
\usepackage{amsmath} % Advanced math typesetting
\usepackage[utf8]{inputenc } % Unicode support (Umlauts etc.)
\usepackage{graphicx} % Add pictures in paper
\usepackage{booktabs}
%\usepackage[ngerman]{babel} % Change hyphenation rules
%\usepackage{listings} % Source code formatting and highlighting
% main document
\begin{document} % The document starts here
\title{My first document using \LaTeX{}}
\date{\today{}}
\author{Pheobus}
\maketitle % Creates the titlepage
\pagenumbering{gobble} % Turns off page numbering
\newpage % Starts a new page
\tableofcontents % Auto-generate a table of content after compile again.
\newpage
\pagenumbering{arabic} % Turns on page numbering
\section{Basic editing}
Equations without numbering as following:
\begin{equation*} % Just exactly one equation
f(x) = f(x-1) + f(x-2)
\end{equation*} % Ampersand * diminish numbering
Equations with numbering as following:
\begin{align}
f(0) &= 0\\
f(1) &= 1\\
f(x) &= f(x-1) + f(x-2)
\end{align}
Align operations as following:
\begin{align*}
f(x) &= x^2\\ % \\ means endline
g(x) &= \frac{1}{x}\\
F(x) &= \int^b_a\frac{1}{3}x^3dx
\end{align*}
% Line feed means indent in same section.
$f(x) = \sqrt{x}$
\subsection{Matrix}
This is a little bracket matrix:
$
[
\begin{matrix}
1 & 0\\
0 & 1\\
\end{matrix}
]
$
\\
This is a bracket matrix:
% Big brackets to cover matrix:
$
\left[
\begin{matrix}
1 & 0\\
0 & 1\\
\end{matrix}
\right]
$
\\
This is a brace matrix:
$
\left(
\begin{matrix}
1 & 0\\
0 & 1\\
\end{matrix}
\right)
$\\
\section{Section Plus}
\paragraph{Paragraph}
Show a simple equation:
$f(x) = \left(\frac{1}{\sqrt{x}}\right)$\\
Table \ref{tab:table1} shows a simple table.
\begin{table}[h!]
\centering
\caption{Caption for the table.}
\label{tab:table1}
\begin{tabular}{l|c||r}
1 & 2 & 3\\
\hline
a & b & c\\
\end{tabular}
\end{table}
\newpage
Table \ref{tab:table2} shows a more sophisticated table.
\begin{table}[h!]
\centering
\caption{Caption for table.}
\label{tab:table2}
\begin{tabular}{ccc}
\toprule
Some & actual & content\\
\midrule
prettifies & the & content\\
as & well & as\\
using & the & booktabs package\\
\bottomrule
\end{tabular}
\end{table}
\newpage
Figure \ref{fig:beauty1} shows a beauty.\\
\begin{figure} % Add a picture.
\includegraphics[width=\linewidth]{beauty.png} % Using absolute path while picture to be added not exists in same folder
\caption{Beauty.}
\label{fig:beauty1}
\end{figure}
\end{document}
效果如下: