我目前正在使用我的机构模板编写一本经过编辑的书的章节。以下是我目前正在进行的工作。
\documentclass[12pt,letterpaper]{book}
\usepackage{bookchapters}
\usepackage{cite}
\begin{document}
\frontmatter
\mainmatter
\input{MNSAR.tex}
\backmatter
\cleardoublepage %index odd numbered page
\printindex %
\end{document}
其中\MNSAR.tex
包含常规章节。同时,bookchapters 包如下。
% For layout
\setlength{\headheight}{5.5pc}
\setlength{\footskip}{1cm}
\setlength{\hoffset}{1cm}
\setlength{\oddsidemargin}{.75in}
\setlength{\evensidemargin}{.75in}
\setlength{\voffset}{-.3in}
\setlength{\topmargin}{-.15in}
\setlength{\headsep}{.55cm}
\setlength{\paperwidth}{6in}
\setlength{\paperheight}{9in}
\setlength{\textwidth}{4.5in}
\setlength{\textheight}{7in}
\setlength{\marginparwidth}{-.3cm}
%--------------------------------------------------------------
% To get rid of default running head
\pagestyle{myheadings}
%---------------------------------------------------------
% For no page number for first page of a chapter
\makeatletter
\renewcommand{\ps@plain}{
\renewcommand{\@oddhead}{}
\renewcommand{\@evenhead}{}
\renewcommand{\@evenfoot}{}
\renewcommand{\@oddfoot}{} }
\makeatother
%---------------------------------------------------------
% For section font
\usepackage{sectsty}
\sectionfont{\normalsize\uppercase}
\subsectionfont{\normalsize}
\subsubsectionfont{\itshape\normalsize}
%---------------------------------------------------------
% For no hyphentaion and right justified
\hyphenpenalty=10000 \sloppy
\raggedbottom
%---------------------------------------------------------
% For caption font size to be 11pt
\makeatletter
\long\def\@makecaption#1#2{\vskip 10\p@
\setbox\@tempboxa\hbox{{\bf\small #1\,\,\,} \small #2}
\ifdim \wd\@tempboxa >\hsize
{\bf\small #1\,\,\,} \small #2\par
\else
\hbox to\hsize{\hfil\box\@tempboxa\hfil}
\fi}
\makeatother
%-------------------------------------------------------------
% To change 1. to (i) etc. in enumerate environment
\renewcommand{\theenumi}{\textup{(\roman{enumi})}}
\renewcommand{\labelenumi}{\theenumi}
%--------------------------------------------------------------
% Coding for BookChapterHeader
\makeatletter
\def\@makechapterhead#1{%
\vspace*{-27\p@}
{\parindent \z@
\centering
\normalfont
\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
\huge
\bfseries
\@chapapp\space \thechapter
\par\nobreak
\vskip .25\baselineskip
\fi
\fi
\interlinepenalty\@M
\LARGE
\bfseries
#1\par\nobreak
\vskip 165\p@
}}
\def\@schapter#1{\if@twocolumn
\@topnewpage[\@makeschapterhead{#1}]%
\else
\@makeschapterhead{#1}%
\@afterheading
\fi}
\def\@makeschapterhead#1{%
{\parindent \z@
\centering
\normalfont
\interlinepenalty\@M
\LARGE
\bfseries
#1\par\nobreak \vskip .25\baselineskip
\vskip 217\p@
}}
\makeatother
\renewcommand{\chaptername}{}
%--------------------------------------------------------------
\usepackage{graphicx} %for .eps file
%-------------------------------------------------------------
\usepackage{latexsym,amsmath,amssymb} % math symbols
\usepackage{makeidx}\makeindex %for index
%--------------------------------------------------------------
% BookChaptersTheoremEnvironment
\usepackage{theorem}
\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{lemma}{Lemma}[chapter]
\newtheorem{corollary}{Corollary}[chapter]
\newtheorem{proposition}{Proposition}[chapter]
{\theorembodyfont{\upshape}
\newtheorem{definition}{Definition}[chapter]
\newtheorem{example}{Example}[chapter]}
\newenvironment{proof}{\begin{paragraph}
{Proof}}{\end{paragraph}}
%--------------------------------------------------------------
\usepackage[sectionbib]{chapterbib} % list of ref. end of chapter
%--------------------------------------------------------------
\renewcommand{\bibname}{REFERENCES}
%------------------------------------------------------------
\usepackage{times} %text times roman
%----------------------------------------------------
\usepackage[noframe]{crop}
%----------------------------------------------------
但是,当我尝试排版上述编码时,我得到的结果如下图所示。
我知道这与我设置的输出类型有关。我使用 Texstudio 作为编辑器,它有一个内部 PDF 查看器。此外,如果我在 PCTex 中将它们排版为 DVI 输出,结果会正确显示。我如何在 Texstudio 中排版它们并让结果为 PDF 而不是 DVI?我不想使用 PCTex,因为他们几年前就没有更新过软件了。
补充:亲爱的@Simon Dispa,我在此附上两张图作为我的请求的参考。第一张图是使用您的编码的输出,第二张图是我想要实现的输出。谢谢。
和
答案1
假设您想使用信纸大小打印一本 6x9 英寸的书,我添加了geometry
此设置(以及选项showframe
)的包,并且修改了包的设置crop
。
这是代码File-Name.tex
\documentclass[12pt, oneside]{book}
\usepackage{bookchapters}
\usepackage{cite}
\usepackage{kantlipsum} % added <<<
\begin{document}
\frontmatter
\mainmatter
\chapter[Numerical Solution]{Numerical Solution of the Acoustic Wave Equation}
\section{INTRODUCTION}
1. \kant[1-9]
\backmatter
\cleardoublepage %index odd numbered page
% \printindex %
\end{document}
这是修改后的bookchapters.sty
(行作为% changed
或% added
)
%%----------------------------------------------------bookchapters starts
%% For layout
\usepackage[papersize={6in,9in},left=0.75in,top=0.2in,margin=0.75in, includehead,includefoot,showframe]{geometry} % added <<<
\setlength{\headheight}{1cm} % changed
\setlength{\footskip}{1cm} % changed
\setlength{\textwidth}{4.5in}
\setlength{\textheight}{7in}
\setlength{\marginparwidth}{0cm} % changed
\setlength{\marginparsep}{0cm}% changed
\usepackage[cam,letter,center]{crop} % changed
%%--------------------------------------------------------------
% To get rid of default running head
\pagestyle{myheadings}
%---------------------------------------------------------
% For no page number for first page of a chapter
\makeatletter
\renewcommand{\ps@plain}{
\renewcommand{\@oddhead}{}
\renewcommand{\@evenhead}{}
\renewcommand{\@evenfoot}{}
\renewcommand{\@oddfoot}{} }
\makeatother
%---------------------------------------------------------
% For section font
\usepackage{sectsty}
\sectionfont{\normalsize\uppercase}
\subsectionfont{\normalsize}
\subsubsectionfont{\itshape\normalsize}
%---------------------------------------------------------
% For no hyphentaion and right justified
\hyphenpenalty=10000 \sloppy
\raggedbottom
%---------------------------------------------------------
% For caption font size to be 11pt
\makeatletter
\long\def\@makecaption#1#2{\vskip 10\p@
\setbox\@tempboxa\hbox{{\bf\small #1\,\,\,} \small #2}
\ifdim \wd\@tempboxa >\hsize
{\bf\small #1\,\,\,} \small #2\par
\else
\hbox to\hsize{\hfil\box\@tempboxa\hfil}
\fi}
\makeatother
%-------------------------------------------------------------
% To change 1. to (i) etc. in enumerate environment
\renewcommand{\theenumi}{\textup{(\roman{enumi})}}
\renewcommand{\labelenumi}{\theenumi}
%--------------------------------------------------------------
% Coding for BookChapterHeader
\makeatletter
\def\@makechapterhead#1{%
\vspace*{-27\p@}
{\parindent \z@
\centering
\normalfont
\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
\huge
\bfseries
\@chapapp\space \thechapter
\par\nobreak
\vskip .25\baselineskip
\fi
\fi
\interlinepenalty\@M
\LARGE
\bfseries
#1\par\nobreak
\vskip 165\p@
}}
\def\@schapter#1{\if@twocolumn
\@topnewpage[\@makeschapterhead{#1}]%
\else
\@makeschapterhead{#1}%
\@afterheading
\fi}
\def\@makeschapterhead#1{%
{\parindent \z@
\centering
\normalfont
\interlinepenalty\@M
\LARGE
\bfseries
#1\par\nobreak \vskip .25\baselineskip
\vskip 217\p@
}}
\makeatother
\renewcommand{\chaptername}{}
%--------------------------------------------------------------
\usepackage{graphicx} %for .eps file
%-------------------------------------------------------------
\usepackage{latexsym,amsmath,amssymb} % math symbols
\usepackage{makeidx}\makeindex %for index
%--------------------------------------------------------------
% BookChaptersTheoremEnvironment
\usepackage{theorem}
\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{lemma}{Lemma}[chapter]
\newtheorem{corollary}{Corollary}[chapter]
\newtheorem{proposition}{Proposition}[chapter]
{\theorembodyfont{\upshape}
\newtheorem{definition}{Definition}[chapter]
\newtheorem{example}{Example}[chapter]}
\newenvironment{proof}{\begin{paragraph}
{Proof}}{\end{paragraph}}
%--------------------------------------------------------------
\usepackage[sectionbib]{chapterbib} % list of ref. end of chapter
%--------------------------------------------------------------
\renewcommand{\bibname}{REFERENCES}
%------------------------------------------------------------
\usepackage{times} %text times roman
%%----------------------------------------------------bookchapters ends
如果要使章节标题以粗体显示,请在中注释该章节%Coding for BookChapterHeader
和,然后在末尾添加 。\usepackage{times}
bookchapters.sty
\chapterfont{\centering \bfseries}
将文件添加crop.cfg
到工作目录。
%% file crop.cfg (to be placed in the working directory)
\renewcommand*\CROP@@ulc{%
\begin{picture}(0,0)
\unitlength\p@\thinlines
\put(-35,0){\line(1,0){30}}
\put(0,35){\line(0,-1){30}}
\end{picture}%
}
\renewcommand*\CROP@@urc{%
\begin{picture}(0,0)
\unitlength\p@\thinlines
\put(35,0){\line(-1,0){30}}
\put(0,35){\line(0,-1){30}}
\end{picture}%
}
\renewcommand*\CROP@@llc{%
\begin{picture}(0,0)
\unitlength\p@\thinlines
\put(-35,0){\line(1,0){30}}
\put(80,-20){\itshape Paper width:\,\the\paperwidth} % adjust h-v position
\put(240,-20){\itshape Paper height:\,\the\paperheight} % adjust h-v position
\put(0,-35){\line(0,1){30}}
\end{picture}%
}
\renewcommand*\CROP@@lrc{%
\begin{picture}(0,0)
\unitlength\p@\thinlines
\put(35,0){\line(-1,0){30}}
\put(0,-35){\line(0,1){30}}
\end{picture}%
}
\renewcommand*\CROP@@info{{%
\global\advance\CROP@index\@ne
\def\x{\discretionary{}{}{\hbox{\kern.5em---\kern.5em}}}%
\advance\paperwidth-20\p@
\dimen@4pt
\ifx\CROP@pagecolor\@empty
\else
\advance\dimen@\CROP@overlap
\fi
\hb@xt@\z@{%
\hss
\vbox to\z@{%
\centering
\hsize\paperwidth
\vss
\itshape
\normalsize
\expandafter\csname\CROP@font\endcsname{%
Job:\kern.4em \jobname\kern10em
Sheet:\kern.3em\the\CROP@index\kern1em
Page:\kern.3em\thepage
\strut
}%
\vskip\dimen@
}%
\hss
}%
}}
\endinput