• 首页
  • 关于

我自然

latex文档模板

在 2009年8月26日 上公布 作者为 yankay

在之前的两个月,补充了不少排版上的知识,是时候发挥一下了。把原先写程序文档的模板加以改进。成果如下。

usepackage{graphicx}
usepackage{indentfirst}
usepackage[usenames,dvipsnames]{color}
usepackage{fancyvrb} % for verbatim
usepackage{fancyhdr}
usepackage{listings}
usepackage[sf]{titlesec}
usepackage{titletoc}
usepackage[boldfont,slantfont,CJKnumber]{xeCJK}
usepackage{xcolor} % 使用颜色宏包
usepackage{color}
usepackage{amsmath, amsfonts, epsfig, xspace}
usepackage{algorithm,algorithmic}
usepackage[normal,tight,center]{subfigure}
usepackage{graphicx}
usepackage{booktabs}
usepackage{longtable}
usepackage{array}
usepackage{multicol}
usepackage{colortbl}

definecolor{steelblue}{rgb}{.275,.51,.71}
definecolor{lpink}{rgb}{.991,.711,.754}
definecolor{mygray}{gray}{0.92}
definecolor{darkblue}{rgb}{0,0,.5}
definecolor{darkgreen}{rgb}{0,.39,0}
definecolor{hgray}{gray}{.5}
definecolor{lgray}{gray}{.8}

usepackage[colorlinks=true,urlcolor=blue,linkcolor=blue]{hyperref} % for links and anchors

setCJKmainfont[BoldFont=Adobe Heiti Std]{Adobe Song Std} % 设置默认的中文字体
setCJKfamilyfont{kai}{Adobe Kaiti Std}

newcommand{kai}{CJKfamily{kai}}
newcommand{sectionname}{第CJKnumber{thesection}章}
newcommand{myheader}[1]{textcolor{darkblue}{#1}}

defprojectName{Enhance2web20}
renewcommandcontentsname{目录}

special{ pdf: bgcolor [ 1.00 0.98 0.95 ] }

linespread{1.382}

pagestyle{fancy}

makeatletter
  fancyhf{}
  lhead{textcolor{hgray}@title}
  rhead{textcolor{hgray}leftmark}
makeatother

makeatletter
renewcommand{maketitle}{
begin{titlepage}%
letfootnotesizesmall
    letfootnoterulerelax
    parindent z@
    reset@font
    vskip 10p@
    hbox{mbox{%
        hspace{4pt}%
        fbox{includegraphics[width=6em]{../logo.png}}%
        hspace{4pt}
        }%
     vrule depth 0.8textheight%
     mbox{hspace{2em}}
     vtop{% %%%%%%%%%%%%%%%%%%
        vskip 40p@
        begin{flushleft}
          Large projectName par
        end{flushleft}
        vskip 80p@
        begin{flushleft}
        textcolor{steelblue}{ fontsize{36}{20pt} bfseries kai @title }par
        end{flushleft}

      }
     }
     rightline{By @author}

  end{titlepage}%
}

makeatother

titleformat{section}[hang]{LARGEsfkai}
            {myheadersectionname}
            {1em}
            {myheader}[color{steelblue}{titlerule}]

titleformat{subsection}[hang]{Largesfkai}
            {myheaderthesubsection}
            {1em}
            {myheader}
titleformat{subsubsection}[hang]{largesfkai}
            {myheaderthesubsubsection}
            {1em}
            {myheader}

titlecontents{section}
              [2em]{largesfkaiaddvspace{-0.1em}}
              {thecontentslabelquad}
%%            {hspace*{-2.3em}}
              {}
              {titlerule*[0.8pc]{.}contentspage}
titlecontents{subsection}
              [4em]{smalladdvspace{-0.2em}}
              {thecontentslabelquad}
%%            {hspace*{-2.3em}}
              {}
              {titlerule*[0.8pc]{.}contentspage}
titlecontents{subsubsection}
              [6em]{smalladdvspace{-0.2em}}
              {thecontentslabelquad}
%%            {hspace*{-2.3em}}
              {}
              {titlerule*[0.8pc]{.}contentspage}

lstset{
keywordstyle=color{blue!70}, commentstyle=color{red!50!green!50!blue!50},
frame=shadowbox,
rulesepcolor=color{red!20!green!20!blue!20}
}
lstset{breaklines}%这条命令可以让LaTeX自动将长的代码行换行排版
lstset{extendedchars=false}

% lstset{ xleftmargin=2em,xrightmargin=2em, aboveskip=1em}

只要把最上面的代码,保存成J_sty_zh.tex,再你的代码中input进去就好了。示例如下:

documentclass[12pt,a4paper,titlepage]{article}
input{J_sty_zh.tex}%% 关键
title{架构说明书}
author{htmladdnormallink{tt Jerry Mouse}{http://jerrymouse.org.cn/}}
date{today}
begin{document}
maketitle
tableofcontents
clearpage
section{引言}
subsection{编写目的}
XXX
end{document}
文章分类 未分类 |
« Gae进阶和优化
终于结束了GaeS »

发表评论 取消回复

您的电子邮箱地址不会被公开。 必填项已用*标注

近期文章

  • 听说 Docker 被 kubenetes 抛弃了,怎么办?containerd
  • 公告 – 博客重开了
  • CloudFoundry v2面面谈,内赠MicroCFv2福利
  • Docker能够运行任何应用的“PaaS”云
  • Scala Tour – 精选

近期评论

  • [整理]完美哈希函数(Perfect Hash Function) - 高性能架构探索发表在《最小完美哈希函数简介》
  • Scala Tour – 精选 - Java天堂发表在《Scala Tour – 精选》
  • Golang适合高并发场景的原因分析 - 站壳网发表在《Go-简洁的并发》
  • HBase 官方文档 – 源码巴士发表在《Windows下eclipse的 C++环境配置》
  • Go-简洁的并发-点开发表在《Go-简洁的并发》

归档

  • 2021年6月
  • 2021年3月
  • 2014年2月
  • 2013年9月
  • 2013年5月
  • 2013年1月
  • 2012年11月
  • 2012年9月
  • 2012年8月
  • 2012年3月
  • 2012年2月
  • 2012年1月
  • 2011年11月
  • 2011年10月
  • 2011年9月
  • 2010年10月
  • 2010年8月
  • 2010年7月
  • 2010年6月
  • 2010年5月
  • 2010年4月
  • 2010年3月
  • 2010年2月
  • 2010年1月
  • 2009年10月
  • 2009年9月
  • 2009年8月
  • 2009年7月
  • 2009年6月
  • 2008年10月
  • 2008年8月
  • 2008年7月
  • 2008年6月

分类目录

  • 家庭生活
  • 未分类
  • 每日心得
  • 软件技术

友情链接

  • DaoCloud Enterprise
  • DaoCloud 云原生一体机

CyberChimps WordPress Themes

沪ICP备2021008917号-1 © 颜开