本文貼一下LaTeX中常用的數(shù)學(xué)符號、物理宏包以及我自己的一個模板。
導(dǎo)師讓四個月交一份筆記,并且要求使用LaTeX,到目前為止已經(jīng)執(zhí)行一年半了,不得不說,導(dǎo)師的這個要求還是十分不錯的,督促我們總結(jié)知識,提升科研能力(zhe ge nan shuo)。我把部分筆記分享到公眾號上也有這個原因。
由于公眾號排版我用墨滴(一款Markdown編輯器,用它寫好之后可以隨時登錄查看,還可以同步到公眾號、知乎等,網(wǎng)址:https://www.mdnice.com/
),所以不常用LaTeX,但是也總結(jié)了一個模板(有圖表索引以及超鏈接等),在這里記錄一下。相關(guān)基礎(chǔ)知識見《LaTeX學(xué)習(xí)筆記》與《LaTeX綜合練習(xí)》。
%導(dǎo)言區(qū)
\documentclass{article} %article, book, report, letter
\usepackage{amsmath}
\usepackage[fontset=mac]{ctex}
\usepackage[hidelinks,colorlinks,linkcolor=blue]{hyperref}%插入目錄并加上超鏈接
\usepackage{color}
\usepackage{minted}
\usepackage{graphicx}
\graphicspath{{figures/}}
\usepackage{amssymb}
%\usepackage{latexalpha2}%在LaTeX中用Mathematica計算
\usepackage{indentfirst}%首行縮進(jìn)
\setlength{\parindent}{1em}
%\usepackage{times}%使得英文默認(rèn)字體都是Times New Roman
%\usepackage[justification=centering]{caption}%全局圖片標(biāo)題居中
\usepackage{float}
\usepackage{tcolorbox}%加邊框
\usepackage{physics}
\usepackage{caption}
\usepackage{subfigure}
\usepackage{multirow}
%參考文獻(xiàn)
\usepackage[style=numeric,backend=biber]{biblatex}
\addbibresource{test.bib}
% 頁面設(shè)置
\usepackage{geometry}
\geometry{a4paper,scale=0.8}
%\usepackage{fontspec}
%\setmonofont{Consolas}
%\usepackage{chngpage}
\definecolor{shadecolor}{rgb}{0.92,0.92,0.92}%文字背景色
\newcommand{\huanhang}[2]{\begin{tabular}{@{ }#1@{ }}#2\end{tabular}}%定義表格內(nèi)換行的命令
%\usepackage[ddmmyyyy]{datetime}%顯示英文日期
%\renewcommand{\dateseparator}{.}
%\renewcommand{\today}{\ifnum\number\day<10 0\fi \number\day \space
%\ifcase \month \or January\or February\or March\or April\or May\or June\or July\or August\or September\or October\or November\or December\fi,
%\number \year} %顯示英文日期
\title{\huge \heiti 模板}
\author{\kaishu 零星}
\date{\today}
%正文區(qū)(文稿區(qū))
\begin{document}
\maketitle
\newpage
\tableofcontents
\newpage
\section{標(biāo)題一}
\subsection{小標(biāo)題一}
\subsubsection{LaTeX中的字體顏色}
這是{\color{red}紅色}、{\color{green}綠色}、{\color{blue}藍(lán)色}和{\color{purple}紫色}。
\subsubsection{LaTeX中的重點突出}
這里展示一個重點突出的內(nèi)容:
\begin{tcolorbox}[colback=red!5!white,colframe=red!75!black,title=布洛赫定理]
三個近似:
1.絕熱近似(離子實不動)
2.單電子近似(平均場、公有化電子)
3.周期勢場近似
布洛赫定理的兩種形式:
1.按照布拉維格子周期性調(diào)幅的平面波形式,即
$$\psi_k(r)=e^{ik\vdot r}u_k(r)$$
其中
$$u_k(r)=u_k(r+R_n)$$
對$R_n$取布拉維格子的所有格矢成立。
2.波矢$k$和布拉維格矢$R_n$表示,即
$$\psi(r+R_n)=e^{ik\vdot R_n}\psi(r)$$
\end{tcolorbox}
\subsubsection{LaTeX中的表格}
這里展示表格:
\begin{table}[htbp]
\centering
\caption{Character table of $C_{3v}$ point group}\label{table1}
\begin{tabular}{c | c | c | c | c | c}
\hline
\multicolumn{3}{c|}{$C_{3v}(3m)$} & E & $2C_3$ & $3\sigma_v$ \\
\hline
$x^2+y^2, z^2$ & $z$ & $A_1$ & 1 & 1 & 1\\
\hline
& $R_z$ & $A_2$ & 1 & 1 & -1\\
\hline
$(x^2-y^2,xy)$ & $(x, y)$ & E & 2 & -1 & 0\\
$(xz, yz)$ & $(R_x, R_y)$ & & & & \\
\hline
\end{tabular}
\end{table}
\subsubsection{LaTeX中的圖片}
這里展示圖片:
\begin{figure}[H]
\centering
\includegraphics[scale=0.8]{Bi2Se3}
\caption{$Bi_2Se_3$}
\label{fig1}
\end{figure}
這里展示水平排列兩個子圖,{\color{red}為了使子圖的小標(biāo)題水平對齊,我們把兩個子圖提前設(shè)置成了一樣長寬比}:
\begin{figure}[htbp]
\centering
\subfigure[Graphene的俯視圖]{
\begin{minipage}{5cm}
\centering
\includegraphics[scale=0.33]{Graphene}
\label{t1}
\end{minipage}
}
\subfigure[Graphene的能帶]{
\begin{minipage}{5cm}
\centering
\includegraphics[scale=0.33]{Graphene-band}
\label{t2}
\end{minipage}
}
\caption{Graphene}
\label{fig2}
\end{figure}
我們可以超鏈接到表\ref{table1}、圖\ref{fig1}和圖\ref{fig2}。
\subsubsection{LaTeX中的數(shù)學(xué)公式和矩陣}
這里展示一個矩陣:
\begin{equation}
H=\begin{pmatrix}
H_{11} & H_{12} & H_{13} & H_{14} \\
& H_{22} & H_{23} & H_{24} \\
& & H_{33} & H_{34} \\
\multicolumn{2}{c}{\raisebox{1.3ex}[0pt]{\Huge \dag}}& & H_{44}
\end{pmatrix}
\end{equation}
這里展示公式:
$$ i\hbar\pdv{\Psi}{t}=-\frac{\hbar^2}{2m}\laplacian{\Psi}+V\Psi $$
\begin{align*}
\sigma_x &=\begin{pmatrix}
0 & 1 \\
1 & 0 \\
\end{pmatrix}&
\sigma_y &=\begin{pmatrix}
0 & -i \\
i & 0
\end{pmatrix}&
\sigma_z &=\begin{pmatrix}
1 & 0 \\
0 & -1
\end{pmatrix}
\end{align*}
\begin{align*}
\boldsymbol{R_1}&=(1,0)& \boldsymbol{R_2}&=(\frac{1}{2},\frac{\sqrt{3}}{2})& \boldsymbol{R_3}&=(-\frac{1}{2},\frac{\sqrt{3}}{2}) \\
\boldsymbol{R_4}&=(-1,0)& \boldsymbol{R_5}&=(-\frac{1}{2},-\frac{\sqrt{3}}{2})& \boldsymbol{R_6}&=(\frac{1}{2},-\frac{\sqrt{3}}{2})
\end{align*}
\begin{equation}
H_{Rashba}=i\lambda_R\sum_{i,j}c_i^\dag (\boldsymbol{s}\times \boldsymbol{d_{ij}})_zc_j
\end{equation}
\begin{align}
\boldsymbol{s}\times \boldsymbol{d_{ij}}=s_x(d_{ij})_y-s_y(d_{ij})_x
\end{align}
\subsubsection{LaTeX中的代碼}
這里展示MATLAB代碼:
\begin{minted}[linenos=true, frame=single,breaklines]{matlab}
f1=figure(1);
set(f1,'Position',[200,200,300,600])
subplot(2,1,1)
grid on
hold on
plot(kx0,E1(:,101),'r')
plot(kx0,E2(:,101),'b')
% axis([-4 4 -1 20])can set the coordinate range
title('band along kx direction')
\end{minted}
這里展示Python代碼:
\begin{minted}[linenos=true, frame=single,breaklines]{python}
# %%
def hamiltonian(kx=0, ky=0, m=1, alpha=0.8): # kx, ky, m, alpha no value is assigned, the value in parentheses will be used by default
h = np.zeros((2, 2)) * (1 + 0j)
h[0, 0] = (kx ** 2 + ky ** 2) / (2 * m)
h[1, 1] = h[0, 0]
h[0, 1] = 1j * alpha * (kx - 1j * ky)
h[1, 0] = h[0, 1].conj()
return h
\end{minted}
\subsubsection{LaTeX中的參考文獻(xiàn)}
引用一篇參考文獻(xiàn),采用上標(biāo)形式\supercite{fu2007topological};采用無格式化引用\cite{fu2008superconducting};采用帶方括號引用\parencite{fu2011topological}。
\subsection{小標(biāo)題二}
\section{標(biāo)題二}
\subsection{小標(biāo)題一}
\subsection{小標(biāo)題二}
\section{標(biāo)題三}
\subsection{小標(biāo)題一}
\subsection{小標(biāo)題二}
\newpage
\nocite{*}
\printbibliography
\end{document}
其中圖片保存在當(dāng)前文件夾下的figures
文件夾,test.bib
中的文獻(xiàn)復(fù)制自谷歌學(xué)術(shù)。
運行代碼之后得到PDF為