LaTeX的一些宏包及细节知识
文章来源:LaTeX的一些宏包及细节知识http://blog.chinaunix.net/uid-20289887-id-1710422.html
这篇是我一年前总结的一些细节知识,有些方法我现在也不怎么使用了,但应该都是正确的。现贴上,给自己一份纪念,给网友一份小礼。^_^
\documentclass[a4paper,11pt,onecolumn]{article}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\usepackage{CJK} % CJK 中文支持
\usepackage{geometry} % 利用 geometry 可以很方便的设置页面的大小。
\usepackage{fancyhdr} % 用 fancyhdr 来设置页眉和页脚十分方便,而且可以在配合 CCT、CJK来设置中文的页眉等。
\usepackage{fancyvrb} % 用来得到一些加框的列举环境
\usepackage{fancybox} % 提供了 \shadowbox, \doublebox, \ovalbox 和 \Ovalbox 四个命令来生成不同形状的盒子。
\usepackage{amsmath,amsfonts,amssymb,graphicx} % EPS 图片支持
\usepackage{subfigure} % 使用子图形
\usepackage{indentfirst} % 中文段落首行缩进
\usepackage{bm} % 公式中的粗体字符(用命令\boldsymbol)
\usepackage{multicol} % 正文双栏
\usepackage{picins} % 图片嵌入段落宏包 比如照片
\usepackage{abstract} % 2栏文档,一栏摘要及关键字宏包
\usepackage{anysize} % 对于像 book 等双面版式来说,这里的 left 和 right 再奇偶页会互换。
\usepackage{hyperref} % 文献引用的宏包
\usepackage{listings}\lstloadlanguages{C,C++,matlab,mathematica} %程序清单关键字宏包
\usepackage{color} % 可以产生有颜色的符号
\usepackage{units} % 用于美化单位及分式
\usepackage{tabularx} % 用于灵活地控制表格的生成
\usepackage{mathrsfs} % 用于产生一种数学用的花体字
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 关于各个宏包的说明。
% CJK宏包中重要的命令为:
% \CJKcaption{GB} 章节标题为中文
% \CJKfamily{hei}{} %song, fs, kai, hei, songsl, fssl, kaisl, heisl
% CTEX中文套装中定义了六种中文字体,分别是
% song, 宋体
% fs, 仿宋
% kai, 楷书
% hei, 黑体 %以上这四种字体都是可以用的,并且还有对应的斜体可用(\it 即可)
% li, 隶书 %但看来这个是不能用的,怎样解决我还不知道,还不懂怎样安装字体
% yuan, 幼圆 %这个也不能用
% geometry宏包重要的命令为:
% \geometry{height=10in,a4paper,body={14cm,21cm}} %具体内容由自己改写
% fancyhdr宏包重要的命令为:
% 如下面所用到的页眉和页脚的定义,很典型的
% fancyvrb宏包重要的命令为:
% 很多,应用方法很灵活。具体查阅其说明文档
% fancybox宏包重要的命令为:
% \shadowbox{}和\doublebox{},括号里面可以包含一个minipage环境,可以含一个图片
% amsmath,amsfonts,amssymb,graphicx宏包重要的命令为:
% 这是一组非常重要的包,最重要的几个命令为:
% \dfrac{}{} %用于显示一种分数,我在一个自定义命令中用过一次
% \includegraphics[width=,height=]{} %插入图片的一般命令
% 有其它的一些常用的符号
% subfigure宏包重要的命令为:
% \subfigure[子标题]{\includegraphics[width=]{}} %详情见下
% indentfirst宏包重要的命令为:
% 用了这个宏包之后,只要在后面连续打两个回车,就可以开始一个新的段,非常方便
% multicol宏包重要的命令为:
% \begin{multicols}{2}
% .......
% \end{multicols}
% 把文字放在这个环境中,就可以使这些文字分成两栏,非常好用。
% picins宏包重要的命令为:
% \parpic(宽度,高度)(水平偏移,垂直偏移)[选项][位置]{图形}
% abstract宏包重要的命令为:
% 这个宏包我还没发现有有用的命令,但鉴于摘要的重要性,就保留它了。
% anysize宏包重要的命令为:
% \marginsize{25mm}{25mm}{15mm}{15mm}
% 用了anysize宏包以后,就可以用它方便地定义两面文档的装订对齐问题了,它会自动切换
% 详情见下
% hyperref宏包重要的命令为:
% 用了这个宏包之后,会发现所有的参考文献和交叉引用都具有了超链接功能,太棒了!
% listings宏包重要的命令为:
% 命令有一两个非常实用,主要是画框和控制程序清单字体的选项
% 它有一个很重要的特性,是可以把各种语言的关键字突显出来,很不错
% units宏包重要的命令为:
% $\nicefrac[\mathcal]{A}{B}$
% \nicefrac{A}{B}
% \nicefrac[\textit]{A}{B}
% $\unitfrac[#1]{#2}{#3}$
% $\unit[#1]{\it #2}$
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%纸张版式的定义
%\marginsize{25mm}{25mm}{15mm}{15mm} %用了anysize宏包以后,就可以用它方便地定义两面文档的装订对齐问题了,它会自动切换,即可代替下邻两句
\geometry{a4paper, hmargin={3.7cm, 3.3cm}, vmargin={1.8cm, 2.5cm}}
\renewcommand{\baselinestretch}{1.5} %定义行间距
\parindent 24pt %重新定义缩进长度
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 自定义命令区
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%定义字体及字号
\newcommand{\song}{\CJKfamily{song}} % 宋体
\newcommand{\fs}{\CJKfamily{fs}} % 仿宋体
\newcommand{\kai}{\CJKfamily{kai}} % 楷体
\newcommand{\hei}{\CJKfamily{hei}} % 黑体
\newcommand{\chuhao}{\fontsize{42pt}{\baselineskip}\selectfont}
\newcommand{\xiaochuhao}{\fontsize{36pt}{\baselineskip}\selectfont}
\newcommand{\yihao}{\fontsize{28pt}{\baselineskip}\selectfont}
\newcommand{\erhao}{\fontsize{21pt}{\baselineskip}\selectfont}
\newcommand{\xiaoerhao}{\fontsize{18pt}{\baselineskip}\selectfont}
\newcommand{\sanhao}{\fontsize{15.75pt}{\baselineskip}\selectfont}
\newcommand{\sihao}{\fontsize{14pt}{\baselineskip}\selectfont}
\newcommand{\xiaosihao}{\fontsize{12pt}{\baselineskip}\selectfont}
\newcommand{\wuhao}{\fontsize{10.5pt}{\baselineskip}\selectfont}
\newcommand{\xiaowuhao}{\fontsize{9pt}{\baselineskip}\selectfont}
\newcommand{\liuhao}{\fontsize{7.875pt}{\baselineskip}\selectfont}
\newcommand{\qihao}{\fontsize{5.25pt}{\baselineskip}\selectfont}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%下面这一块程序用于去掉图片标题中的冒号
\makeatletter
\long\def\@makecaption#1#2{%
\vskip\abovecaptionskip
\sbox\@tempboxa{#1\quad #2}%
\ifdim \wd\@tempboxa >\hsize
#1\quad #2\par
\else
\global \@minipagefalse
\hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
\fi
\vskip\belowcaptionskip}
\makeatother
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%下面这一片区域用来定义程序清单环境中的样式细节设置
\lstset
{
frameround=tttt, % define the frame style
%frameshape={RYRYNYYYY}{yny}{yny}{RYRYNYYYY}
basicstyle=\small, % print whole listing small
%keywordstyle=\color{red}\underbar, % underlined bold red keywords
%identifierstyle={}, % nothing happens to other identifiers
%commentstyle=\color{white}, % white comments
%stringstyle=\ttfamily, % typewriter type for strings
%stringspaces=false % no special string spaces
}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 关于去掉首页的页码的方法
% 在\maketitle后加上\thispagestyle{empty}就可以了
% 想让所有的页都无页码,则如下操作
% \makeatletter
% \let\ps@plain=\ps@empty
% \makeatother
% \pagestyle{empty}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 把proof环境中的关键字proof改为"证明"的方法
% \proofname{证明}
% 或
% \begin{proof}{证明}
% ........
% \end{proof}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%这一块用来美化行内公式时靠字太紧的现象
\newcommand{\f}[1]{\,\,$#1$\,}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%这一块用来美化输出一行序列时的各元素项靠得太紧的情况
\newcommand{\seq}[4]{{\,\,(#1\,\,\,}{#2\,\,\,}{#3\,\,\,}{#4)}}
\newcommand{\se}[4]{{\,\,#1\,\,\,}{#2\,\,\,}{#3\,\,\,}{#4\,}}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 脚注的行号默认是从每一章开始计数的,现在要求从每一页开始计数
% \makeatletter\@addtoreset{footnote}{page}
% \makeatother
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 这一句用来把脚注的序号由*号改成阿拉伯数字,当然也可换成其它几种类型之一
% \renewcommand{\thefootnote}{\arabic{footnote}}
% \renewcommand{\thepage}{--\roman{page}--} %变化非常多,应用很灵活
% 编号方式一共有五种:\arabic, \roman, \Roman, \alph, \Alph
% 常用的计数器有\thepage<-->page, \thechapter<-->chapter, \theequation<-->equation
% \thefootnote<-->footnote, \thefigure<-->figure, \thetable<-->table
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 此行代码用来美化分式的输出
%\newcommand{\tgfrac}[2]{\raisebox{0.1cm}{\dfrac{\raisebox{-0.07cm}{\it #1}}{\raisebox{-0.01cm}{\it #2}}}\,}
% 另外,在有\usepackage{units}的情况下,还可以用\nicefrac[\mathcal]{#1}{#2}进行左右型的分式输出
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 此行使标号引用的形式更好看一点
%\newcommand{\re}[1]{\,(\ref{#1})\,} %后面就用在要加参考文献的地方
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 此行使文献引用以上标形式显示
\newcommand{\supercite}[1]{\textsuperscript{\cite{#1}}} %后面就用在要加参考文献的地方
% 写上\supercite{自定的符号}即可
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 简化列举环境中的打字的繁琐
%\newcommand{\tgitem}{\vspace{-2.8mm}\item}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 正文两栏环境不允许float环境,比如 figure, table。所以重新定义
% figure,使之可以浮动到你想要的位置。table也同样,把figure改为
% table就可以。
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\newenvironment{figurehere}
% {\def\@captype{figure}}
% {}
%\makeatother
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 文章正文
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\begin{document}
\begin{CJK*}{GBK}{song}
\CJKcaption{GB}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 此行代码用来美化汉字中数字及字母的输出
%\newcommand{\m}[1]{\,#1\,}
% 另外,在有\usepackage{units}的情况下,还可以用\nicefrac{#1}{#2}进行左右型的分式输出
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 此行代码用来美化汉字中破折号的输出
%\newcommand{\pzh}{\,-\!\!-\,} %破折号,在这里定义的原因是-为全角符号,只能在CJK声明后才能识别
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 此行代码用来美化汉字中小括号和中括号的输出
%\newcommand{\xkh}[1]{\!\!(#1)\!\!}
%\newcommand{\zkh}[1]{\!\![#1]\!\!}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 这一块用来记录一些很细微的经验
% *\!缩小1/3个半角字符宽,\,增加1/3个半角字符宽,\quad 增加一个全角字符宽,\qquad 增加两个全角字符宽
% *中文的破折号用“-\!\!-”来表示。
% *$A\stackrec{1;/\!/}{=}B$会得到使平行号骑在等号上面的效果
% *空心方块如下表示:\hfill\blacksquare
% *要得到数学中的花体字,得\usepackage{mathrsfs} 然后后面再用$\mathscr{ABCD..}$引用
% *公式中用\text{-}表示短横线
% *用\usepackage{letteine}使文章的英文第一个字母变大
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
LaTeX的一些宏包及细节知识的更多相关文章
- LaTeX使用titlesec宏包改变章节编号形式的方法
1.titleformat宏包命令详解 LaTeX中可以用titlesec宏包中的titleformat命令来改变标题形式: 导入宏包: \usepackage{titlesec} 改变标题的代码如下 ...
- Windows 下 LaTeX 手动安装宏包(package)以及生成帮助文档的整套流程
本文简单介绍如何手动安装一个 LaTeX 宏包. 一般来说,下载的 TeX 发行版已经自带了很多宏包,可以满足绝大部分需求,但是偶尔我 们也可能碰到需要使用的宏包碰巧没有安装的情况,这时我们就需要自己 ...
- LaTeX手动安装宏包(package)以及生成帮助文档的整套流程
注意:版权所有,转载请注明出处. 我使用的是ctex套装,本来已经自带了许多package,但是有时候还是需要使用一些没有预装的宏包,这时就需要自己安装package了.下载package可以从CTA ...
- LaTeX中titlesec宏包的使用
在 xelatex 中使用 \usepackage 指令使用 titlesec 宏包时,可以指定一些格式选项,如下: \usepackage[center]{titlesec} 其中 center 可 ...
- LaTeX源代码显示宏包listings应用备忘之新语言定义
我目前了解的LaTeX中有关源代码显示的宏包有两个,这里介绍其中的listings宏包.listings宏包中已经定义了部分计算机语言的显示样式,但还是有些语言没有定义,我们一起看一下如何定义新的 ...
- LaTeX的tasks宏包
tasks 宏包 LaTeX的列表(list)通常是将项(item,条目)一个一个垂直的平行显示,所谓"列"表的由来. 水平分列列表,即将多个项分散到各列而不是一列,在出考卷的选择 ...
- [原创][LaTex]LaTex学习笔记之框架及宏包
0. 简介 LaTex在书写文档时的最基本单元就是首部的写作,变相的也可以说是头文件.本文章就来总结一下文档的基本格式和常用宏包. 1. 基本单元 基本单元需要对LaTex语法有一定的了解,这个很简单 ...
- 在LaTeX中利用preview宏包和tikz宏包生成单图pdf
有时候我们利用tikz宏包画出的图片后,只想生成一个单图pdf,而且pdf的页面大小与图片相同,以便于以后再次用latex插入. 可以与preview宏包进行搭配,页面大小由图像大小决定,可以通过改变 ...
- LaTeX自定义宏包、类文件的默认搜索路径设置方法
对于自定义的LaTeX宏包与类,在调用时可以通过在命令\documentclass{}与\usepackage{}命令中指定完整路径或者相对路径,这样确实可以调用,但是编译时总是有烦人的警告信息, ...
随机推荐
- 微服务日志监控与查询logstash + kafka + elasticsearch
使用 logstash + kafka + elasticsearch 实现日志监控 https://blog.csdn.net/github_39939645/article/details/788 ...
- URAL1277 Cops and Thieves(最小割)
Cops and Thieves Description: The Galaxy Police (Galaxpol) found out that a notorious gang of thieve ...
- POJ1456:Supermarket(并查集+贪心)
Supermarket Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 17634 Accepted: 7920 题目链接 ...
- 编程技巧 - malloc()与free()
1.要节省ram资源,可以使用malloc()动态申请内存,使用完再用free()释放掉,free()释放的是指针指向的内存空间,而不是指针. 2.如果某个大数组要在两个函数中使用,可以先定义一个全局 ...
- 入门级:GitHub和Git超超超详细使用教程!
GitHub和Git入门 考虑到大家以前可能对版本控制工具和Linux命令行工具都不了解,我写了一个简单的博客来让大家学会入门使用方法. GitHub的简单使用 第一步 创建GitHub账号 1. 打 ...
- c++对拍实现
直接上代码吧. #include<bits/stdc++.h> using namespace std; int main(){ while(1){ system("./cute ...
- Python基础(2)_if、for、while流程控制
一.流程控制 1.条件语句 1.1单分支 1.2多分支 条件判断 计算机之所以能做很多自动化的任务,因为它可以自己做条件判断. a = 5 if a > 2: print('yes') 根据Py ...
- 如何打开小米,oppo,华为等手机的系统应用的指定页面
如题,拿Oppo 手机做个示例,小米 华为也是如此. 在编写Android应用的时候,我们经常会有这样的需求,我们想直接打开系统应用的某个页面.比如在Oppo R9 手机上我们想打开某个应用的通知管理 ...
- 【洛谷 P4342】[IOI1998]Polygon(DP)
题目链接 题意不再赘述. 这题和合并石子很类似,但是多了个乘法,而乘法是不满足"大大得大"的,因为两个非常小的负数乘起来也会很大,一个负数乘一个很大的整数会很小,所以我们需要添加一 ...
- 【洛谷 P2480】 [SDOI2010]古代猪文(中国剩余定理,Lucas定理)
题目链接 这题出的有点nb,PKU: Pig Kingdom University , NOIP: National Olympics in Informatic of Pigs... 题意:求\(G ...