LaTex一个双栏book文档实例

如下:

 

%openany不强制要求从偶数页开始一章
%可以自定义一栏或两栏
\documentclass[UTF8,a4paper,towcolumn,openany]{ctexbook}
\usepackage{graphicx,geometry,fontspec,fancyhdr,balance,ragged2e,datatool,booktabs}

%页边距
\geometry{left=2cm,right=2cm,top=3.0cm,bottom=3cm}
\graphicspath{{figs/}}
%两栏时的栏距
\setlength\columnsep{0.7cm}
\balance %双栏平衡


%设置字体
%设置Times New Roman为默认的英文字体
\setmainfont{Times New Roman}
%设置雅黑为默认字体,会影响目录字体,chapter字体
\setCJKmainfont{Microsoft YaHei}[AutoFakeBold]
%设置楷体为页眉字体
\setCJKfamilyfont{ft}{STKaiti}[AutoFakeBold,AutoFakeSlant] 
\newcommand{\pagehead}{\CJKfamily{ft}\zihao{-4}}

%正文雅黑,4号
\newcommand{\maintext}{\rmfamily\zihao{4}} 
%设置章节标题格式
\CTEXsetup[name={第,章}]{chapter} %不设的话,自动也是这样的,应该是ctexbook带的
%\CTEXsetup[name={第,讲}]{section}
%使用中文数字
%\CTEXsetup[number={\chinese{section}}]{section}
%阿拉伯数字
\CTEXsetup[number={\arabic{chapter}}]{chapter}
%section字体
%\CTEXsetup[format={\zihao{3}\rmfamily\centering}]{section}

\setlength{\parskip}{0.2\baselineskip} %段间距

%题目
\title{\songti\zihao{1} 大标题 \\ \zihao{3}\vspace{+4mm}副标题}
\author{\zihao{-2}作者} 
\date{2019-3-24} 

\begin{document}
    \pagestyle{empty}
    \maketitle%将封面打印出来
    \pagenumbering{Roman}% 与正文数字页码区别
    \tableofcontents %输出目录
    \newpage
    
    \setcounter{page}{1} %必须在pagenumbering之前    
    \pagenumbering{arabic}%改为数字页码
    
    \pagestyle{fancy}
    \fancyhf{}
    %改变页眉字体
    \fancyhead[LO,RE]{\pagehead\itshape\rightmark}
    \fancyhead[LE,RO]{\pagehead\itshape\leftmark}
    \fancyfoot[C]{\thepage}
    
    \maintext
    %第一章
    \InputIfFileExists{tex/chapter1}{}{}
    %第二章
    \InputIfFileExists{tex/chapter2}{}{}
    \InputIfFileExists{tex/chapter3}{}{}
    \InputIfFileExists{tex/chapter4}{}{}
    \InputIfFileExists{tex/chapter5}{}{}
    \InputIfFileExists{tex/chapter6}{}{}
    \InputIfFileExists{tex/chapter7}{}{}
    \InputIfFileExists{tex/chapter8}{}{}
    \InputIfFileExists{tex/chapter9}{}{}
    \InputIfFileExists{tex/chapter10}{}{}
    
    
\end{document}

 

posted on 2019-08-13 11:20  arsh  阅读(1223)  评论(0编辑  收藏  举报

导航