LaTeX的一些代码样式
把自己总结的用了很久的一些LaTeX的代码样式发上来,这些样式平时用得很多。对我来说非常珍贵呀。
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%一些最基本的环境
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%居中环境
\begin{center}
\end{center}
%左对齐环境
\begin{flushleft}
\end{flushleft}
%右对齐环境
\begin{flushright}
\end{flushright}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%小页环境(可嵌入上面那三种环境中形成组合)
\begin{minipage}{**cm}
\end{minipage}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%列举样式
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% itemize 列举样式1:· · · ·
\begin{itemize}
\vspace{-2.8mm}\item
\vspace{-2.8mm}\item
\end{itemize}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% itemize 列举样式2:* * * *
\begin{itemize}
\vspace{-2.8mm}\item[*]
\vspace{-2.8mm}\item[**]
\end{itemize}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% itemize 列举样式3:任意符号
\begin{itemize}
\renewcommand\labelitemi{}%这里面写符号
\vspace{-2.8mm}\item
\vspace{-2.8mm}\item
\end{itemize}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% itemize 列举样式4:彩色符号
\begin{itemize}
\setlength\baselineskip{12pt} %用这个命令来调整间距应该比较具有通用性
\item[\textcolor{black}{$\spadesuit$}] 文字。。。
\item[\textcolor{red}{$\heartsuit$}] 文字。。。
\item[\textcolor{black}{$\clubsuit$}] 文字。。。
\item[\textcolor{red}{$\diamondsuit$}] 文字。。。
\end{itemize}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% enumerate 列举样式1:1. 2. 3. 4.
\begin{enumerate}
\vspace{-2.8mm}\item
\vspace{-2.8mm}\item
\end{enumerate}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% enumerate 列举样式2:(1) (2) (3) (4)
\begin{enumerate}
\renewcommand\labelenumi{ \theenumi }%就在前面那个括号的空格处加符号
%\setlength\itemindent{}%这个会使列举的左移或右移指定的距离
\vspace{-2.8mm}\item
\vspace{-2.8mm}\item
\end{enumerate}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%图形插入样式
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%图形排版样式1:定点
%图形排版时名称一般都在下方
\begin{center}
\includegraphics[width=10cm,height=6cm]{*.eps}%就在前面括号中写图片名
\renewcommand{\figurename}{图}
\caption{}
\label{}
\end{center}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%图形排版样式2:浮动
%图形排版时名称一般都在下方
\begin{figure}
\begin{center}
\includegraphics[width=10cm,height=6cm]{*.eps}%就在前面括号中写图片名
\renewcommand{\figurename}{图}
\caption{}
\label{}
\end{center}
\end{figure}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%图形排版样式3:两个图片并列,统一取名
%图形排版时名称一般都在下方
\begin{figure}
\begin{center}
\begin{minipage}[c]{0.5\textwidth}
\centering\includegraphics[width=5cm,height=3cm]{*.eps}%就在前面括号中写图片名
\end{minipage}%
\begin{minipage}[c]{0.5\textwidth}
\centering\includegraphics[width=5cm,height=3cm]{*.eps}%就在前面括号中写图片名
\end{minipage}
\renewcommand{\figurename}{图}
\caption{}
\label{}
\end{center}
\end{figure}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%图形排版样式4:两个图片并列,分别取名
%图形排版时名称一般都在下方
\begin{figure}
\begin{center}
\begin{minipage}[c]{0.5\textwidth}
\centering\includegraphics[width=5cm,height=3cm]{}%就在前面括号中写图片名
\renewcommand{\figurename}{图}
\caption{ }
\label{}
\end{minipage}%
\begin{minipage}[c]{0.5\textwidth}
\centering\includegraphics[width=5cm,height=3cm]{}%就在前面括号中写图片名
\renewcommand{\figurename}{图}
\caption{ }
\label{}
\end{minipage}
\end{center}
\end{figure}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%图形排版样式5:两个图片作为子图并列,分别取名。四个可形成图形阵列。在下方有一个总名称
\begin{figure}
\centering
\subfigure[子标题]{\includegraphics[width=0.45\textwidth]{*.eps}}
%\mbox{\hspace{0.5cm}}
\subfigure[子标题]{\includegraphics[width=0.45\textwidth]{*.eps}}
\\
\subfigure[子标题]{\includegraphics[width=0.45\textwidth]{*.eps}}
%\mbox{\hspace{0.5cm}}
\subfigure[子标题]{\includegraphics[width=0.45\textwidth]{*.eps}}
\renewcommand{\figurename}{图}
\caption{总标题}
\label{}
\end{figure}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%图形排版样式6:图片在盒子中
\begin{figure}
\begin{center}
\fbox{\includegraphics[width=10cm,height=6cm]{*.eps}}%就在前面括号中写图片名
\renewcommand{\figurename}{图}
\caption{}
\label{}
\end{center}
\end{figure}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%图形排版样式7:图文混排,段落插入图片用picins宏包和\parpic命令
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\parpic{%
\includegraphics[width=3.0cm]%
{*.eps}}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 表格样式
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 基本表格样式
% 在下面那个括号中,用|表示画竖线,而l表示单元格中的内容在单元格中左对齐,
% c表示单元格中的内容在单元格中中对齐,r表示单元格中的内容在单元格中右对齐。
% 如|c|c|c|就表示画一个3列有竖线的表,当然|也可略,就不画竖线出来;
% 用\hline画横线,一般是表的一行内容输入完并强制换行(\\)后,在后面写
% \hline,然后后面再写下一行内容。当然\hline也可略,就不画横线出来;
% 下面这个表格是一个3行3列的表格
\begin{tabular}{|c|c|c|}
\hline
*** & *** & ***\\
\hline
*** & *** & ***\\
\hline
*** & *** & ***\\
\end{tabular}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 下面这种形式可以指定表格的宽度。在下面那个括号中写上0.5\textwidth
% 就可得到一个半张纸宽的一个表格;
% 写上\textwidth就可得到一个整张纸宽的一个表格。
\begin{tabular*}{***}{|c|c|c|}
\hline
*** & *** & ***\\
\hline
*** & *** & ***\\
\hline
*** & *** & ***\\
\end{tabular*}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 表格样式1:标题在图表上方,去掉了冒号
\begin{table}
\begin{center}
%\makeatletter\def\@captype{table}\makeatother
\renewcommand{\tablename}{表}
\caption{}
\label{}
\begin{tabular}{}
\end{tabular}
\end{center}
\end{table}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%表格样式2:用tabularx宏包
\begin{center}
\begin{tabularx}{350pt}{|c|X|c|X|}
\hline
\multicolumn{2}{|c|}{Multicolumn entry!}& THREE& FOUR\\
\hline
one&
\raggedright\arraybackslash\setlength\baselineskip{12pt}
The width of this column depends on the width of the table.& three&
\raggedright\arraybackslash\setlength\baselineskip{12pt}
Column four will act in the same way as column two, with the same width. \\
\hline
\end{tabularx}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%表格样式3:高级表格控制
\begin{table}
\begin{center}
\scriptsize
\renewcommand{\arraystretch}{1.3}
\caption{Quasi-normal frequencies for the scalar perturbation in
the stationary Schwarzschild background. \label{tab:1}}
\begin{tabularx}{380pt}{*{5}{>{\centering\arraybackslash}X|}>{\centering\arraybackslash}X}
\hline &&\multicolumn{2}{c|}
{\textbf{Exact solution}}&\multicolumn{2}{c}{\textbf{Numerical solution}} \\
\hline
$\sqrt{M}$&$m$&$\omega_R$&$\omega_I$&$\omega_R$&$\omega_I$ \\
\hline
0.2&1&1&-0.4&1.002&-0.400 \\
0.4&1&1&-0.8&0.965&-0.799 \\
0.4&2&2&-0.8&2.003&-0.800 \\
0.4&3&3&-0.8&3.004&-0.800 \\
0.4&4&4&-0.8&4.005&-0.800 \\
0.5&2&2&-1&1.999&-1.000 \\
0.5&3&3&-1&2.993&-1.000 \\
0.5&4&4&-1&4.007&-1.000 \\
1&4&4&-2&4.004&-2.001 \\
2&10&10&-4&10.014&-4.001 \\
3&10&10&-6&10.028&-6.011 \\
4&10&10&-8&9.973&-7.983 \\
\hline
\end{tabularx}
\end{center}
\end{table}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%公式样式
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%摘引环境1:段摘引
\begin{verbatim}
\end{verbatim}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%摘引环境2:行内摘引
\verb|*********|
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%程序清单样式
\lstset{language=matlab}
\begin{lstlisting}[frame=trBL]{}
clf;
k=-80:80;
a(k~=0)=sin(pi*k(k~=0)/2)./(k(k~=0)*pi);
a(k==0)=0.5;
stem(k,a);
t=-3:0.01:3
\end{lstlisting}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 参考文献样式
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\small
\renewcommand\refname{\hei 参考文献}
\begin{thebibliography}{99}
\setlength{\parskip}{0pt} %段落之间的竖直距离
\bibitem{tang}
\bibitem{liu}
\end{thebibliography}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 参考文献结束
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
阅读(1642) | 评论(0) | 转发(0) |