• LaTeX的一些宏包及细节知识


    文章来源:LaTeX的一些宏包及细节知识http://blog.chinaunix.net/uid-20289887-id-1710422.html

    ps:我的机器上软件并不能直接运行通,下面“代码”,感觉很多有用的东西,慢慢的边用边验证吧!
    以下是直接copy原文的。
     
    LaTeX的一些宏包及细节知识
    2007年01月12日 星期五 17:45

    这篇是我一年前总结的一些细节知识,有些方法我现在也不怎么使用了,但应该都是正确的。现贴上,给自己一份纪念,给网友一份小礼。^_^
     

    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}          % 公式中的粗体字符(用命令oldsymbol)
    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宏包重要的命令为:
    %    egin{multicols}{2}
    %    .......
    %    end{multicols}
    %    把文字放在这个环境中,就可以使这些文字分成两栏,非常好用。
    % picins宏包重要的命令为:
    %    parpic(宽度,高度)(水平偏移,垂直偏移)[选项][位置]{图形} 
    % abstract宏包重要的命令为:
    %    这个宏包我还没发现有有用的命令,但鉴于摘要的重要性,就保留它了。
    % anysize宏包重要的命令为:
    %    marginsize{25mm}{25mm}{15mm}{15mm} 
    %    用了anysize宏包以后,就可以用它方便地定义两面文档的装订对齐问题了,它会自动切换
    %    详情见下
    % hyperref宏包重要的命令为:
    %    用了这个宏包之后,会发现所有的参考文献和交叉引用都具有了超链接功能,太棒了!
    % listings宏包重要的命令为:
    %    命令有一两个非常实用,主要是画框和控制程序清单字体的选项
    %    它有一个很重要的特性,是可以把各种语言的关键字突显出来,很不错
    % units宏包重要的命令为:
    %    $ icefrac[mathcal]{A}{B}$
    %    icefrac{A}{B}
    %    icefrac[ extit]{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}}
    enewcommand{aselinestretch}{1.5} %定义行间距
    parindent 24pt %重新定义缩进长度
    %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %  自定义命令区
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %定义字体及字号
    ewcommand{song}{CJKfamily{song}} % 宋体
    ewcommand{fs}{CJKfamily{fs}} % 仿宋体
    ewcommand{kai}{CJKfamily{kai}} % 楷体
    ewcommand{hei}{CJKfamily{hei}} % 黑体
    ewcommand{chuhao}{fontsize{42pt}{aselineskip}selectfont}
    ewcommand{xiaochuhao}{fontsize{36pt}{aselineskip}selectfont}
    ewcommand{yihao}{fontsize{28pt}{aselineskip}selectfont}
    ewcommand{erhao}{fontsize{21pt}{aselineskip}selectfont}
    ewcommand{xiaoerhao}{fontsize{18pt}{aselineskip}selectfont}
    ewcommand{sanhao}{fontsize{15.75pt}{aselineskip}selectfont}
    ewcommand{sihao}{fontsize{14pt}{aselineskip}selectfont}
    ewcommand{xiaosihao}{fontsize{12pt}{aselineskip}selectfont}
    ewcommand{wuhao}{fontsize{10.5pt}{aselineskip}selectfont}
    ewcommand{xiaowuhao}{fontsize{9pt}{aselineskip}selectfont}
    ewcommand{liuhao}{fontsize{7.875pt}{aselineskip}selectfont}
    ewcommand{qihao}{fontsize{5.25pt}{aselineskip}selectfont}
    %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %下面这一块程序用于去掉图片标题中的冒号
    makeatletter
    longdef@makecaption#1#2{%
     vskipabovecaptionskip
     sbox@tempboxa{#1quad #2}%
     ifdim wd@tempboxa >hsize
       #1quad #2par
     else
       global @minipagefalse
       hb@xt@hsize{hfilox@tempboxahfil}%
     fi
     vskipelowcaptionskip}
    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= tfamily, % typewriter type for strings
    %stringspaces=false % no special string spaces
    }
    %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    % 关于去掉首页的页码的方法
    % 在maketitle后加上 hispagestyle{empty}就可以了
    % 想让所有的页都无页码,则如下操作
    % makeatletter
    % letps@plain=ps@empty
    % makeatother
    % pagestyle{empty}
    %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    % 把proof环境中的关键字proof改为"证明"的方法
    % proofname{证明}
    % 或 
    % egin{proof}{证明}
    %  ........
    % end{proof}
    %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %这一块用来美化行内公式时靠字太紧的现象
    ewcommand{f}[1]{\,\,$#1$\,}
    %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %这一块用来美化输出一行序列时的各元素项靠得太紧的情况
    ewcommand{seq}[4]{{\,\,(#1\,\,\,}{#2\,\,\,}{#3\,\,\,}{#4)}}
    ewcommand{se}[4]{{\,\,#1\,\,\,}{#2\,\,\,}{#3\,\,\,}{#4\,}}
    %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %  脚注的行号默认是从每一章开始计数的,现在要求从每一页开始计数
    % makeatletter@addtoreset{footnote}{page}
    % makeatother
    %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    % 这一句用来把脚注的序号由*号改成阿拉伯数字,当然也可换成其它几种类型之一
    %  enewcommand{ hefootnote}{arabic{footnote}}
    %  enewcommand{ hepage}{-- oman{page}--} %变化非常多,应用很灵活
    %  编号方式一共有五种:arabic, oman, Roman, alph, Alph
    % 常用的计数器有 hepage<-->page, hechapter<-->chapter, heequation<-->equation
    % hefootnote<-->footnote, hefigure<-->figure, hetable<-->table
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    % 此行代码用来美化分式的输出
    % ewcommand{ gfrac}[2]{ aisebox{0.1cm}{dfrac{ aisebox{-0.07cm}{it #1}}{ aisebox{-0.01cm}{it #2}}}\,}
    % 另外,在有usepackage{units}的情况下,还可以用 icefrac[mathcal]{#1}{#2}进行左右型的分式输出
    %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    % 此行使标号引用的形式更好看一点
    % ewcommand{ e}[1]{\,( ef{#1})\,} %后面就用在要加参考文献的地方
    %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    % 此行使文献引用以上标形式显示
    ewcommand{supercite}[1]{ extsuperscript{cite{#1}}} %后面就用在要加参考文献的地方
    % 写上supercite{自定的符号}即可
    %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    % 简化列举环境中的打字的繁琐
    % ewcommand{ gitem}{vspace{-2.8mm}item}
    %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    % 正文两栏环境不允许float环境,比如 figure, table。所以重新定义
    % figure,使之可以浮动到你想要的位置。table也同样,把figure改为
    % table就可以。
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    % ewenvironment{figurehere}
    % {def@captype{figure}}
    %  {}
    %makeatother
    %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %  文章正文
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %
    egin{document}
    egin{CJK*}{GBK}{song}
    CJKcaption{GB}
    %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    % 此行代码用来美化汉字中数字及字母的输出
    % ewcommand{m}[1]{\,#1\,}
    % 另外,在有usepackage{units}的情况下,还可以用 icefrac{#1}{#2}进行左右型的分式输出
    %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    % 此行代码用来美化汉字中破折号的输出
    % ewcommand{pzh}{\,-!!-\,} %破折号,在这里定义的原因是-为全角符号,只能在CJK声明后才能识别
    %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    % 此行代码用来美化汉字中小括号和中括号的输出
    % ewcommand{xkh}[1]{!!(#1)!!} 
    % ewcommand{zkh}[1]{!![#1]!!}
    %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    % 这一块用来记录一些很细微的经验
    % *!缩小1/3个半角字符宽,\,增加1/3个半角字符宽,quad 增加一个全角字符宽,qquad 增加两个全角字符宽
    % *中文的破折号用“-!!-”来表示。
    % *$Astackrec{1;/!/}{=}B$会得到使平行号骑在等号上面的效果
    % *空心方块如下表示:hfilllacksquare
    % *要得到数学中的花体字,得usepackage{mathrsfs} 然后后面再用$mathscr{ABCD..}$引用
    % *公式中用 ext{-}表示短横线
    % *用usepackage{letteine}使文章的英文第一个字母变大
    %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

  • 相关阅读:
    函数防抖与函数节流 封装好的debounce和throttle函数
    机顶盒
    getchar() putchar()
    【整】char、varchar、nchar、nvarchar的区别
    主机名
    主机
    java中的匿名内部类总结
    智能路由器又多一个玩家——乐视TV
    乐视开始折腾路由器,小米与极路由还会好过吗?
    带你认识什么是路由器
  • 原文地址:https://www.cnblogs.com/pursuitofacm/p/6589313.html
Copyright © 2020-2023  润新知