我正在努力适应优雅的书籍模板为我的书。我做了一些更改,但在调整模板时遇到了以下问题:
出版商要求的页面布局,我已使用布局包将其打印为 PDF。我想使用 Elegant Book 模板复制此页面布局(请参见下图):)。
我想在所有页面上添加裁切标记,宽度为 6.14 英寸,高度为 9.30 英寸。
与第 2 点相关,我尝试过的所有模板,裁切标记在第一章开始之前都正确显示,但从第一章开始它们就被扰乱了(打印在错误的位置)(请参见下图:)。
如何为奇数页和偶数页设置不同的页眉。目前,两边都有章节编号和标题,但我更希望在偶数页(右对齐)显示章节编号和简短章节标题,在奇数页(左对齐)显示章节编号和章节标题,就像许多出版物一样。
我不想缩进段落的第一行。
如果这些问题有些幼稚,我很抱歉。我只熟悉 LaTeX 的高级用法,这是我第一次格式化一本书。
我的 book.tex 文件如下:
% \documentclass[11pt]{elegantbook}
\documentclass[black,10pt]{elegantbook}
\usepackage{fixltx2e,fix-cm}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{wrapfig,lipsum,booktabs}
\usepackage{subfigure}
\usepackage{makeidx}
\usepackage{multicol}
%\usepackage[breaklinks]{hyperref}
% \usepackage{ragged2e}
%\usepackage{algpseudocode}
%\usepackage[ruled,vlined]{algorithm2e}
\usepackage[linesnumbered,ruled,vlined]{algorithm2e}
% \usepackage[dvips=false,pdftex=false,vtex=false]{geometry}
% \geometry{
% paperwidth=6.14in%4.71875in,
% paperheight=9.30in%4.75in,
% % margin=2em,
% % bottom=1.5em,
% %nohead
% }
% \usepackage[cam,a4,center,dvips]{crop}
\usepackage[
% set width and height to a4 width and height + 6mm
width=6.14in, height=9.30in,
% width=21.6truecm, height=30.3truecm,
% use any combination of these options to add different cut markings
cam, axes, frame, cross,
% set the type of TeX renderer you use
pdftex,
% center the contents
center
]{crop}
\usepackage{lscape}
\usepackage{tipa}
\let\ipa\textipa
\usepackage{vowel}
\usepackage{adjustbox}
% \usepackage{showframe}
\usepackage{rotating}
\newcommand{\BlankCell}{}
\usepackage[
left = \flqq{},%
right = \frqq{},%
leftsub = \flq{},%
rightsub = \frq{} %
]{dirtytalk}
\usepackage[english]{babel}
\usepackage{csquotes}
\usepackage[T1]{fontenc}
\usepackage{listings}
\usepackage[lastexercise]{exercise}
\usepackage{xcolor}
\usepackage{courier}
\frenchspacing
\tolerance=5000
% \definecolor{codegreen}{rgb}{0,0.6,0}
% \definecolor{codegray}{rgb}{0.5,0.5,0.5}
% \definecolor{codepurple}{rgb}{0.58,0,0.82}
% \definecolor{backcolour}{rgb}{0.95,0.95,0.92}
\lstdefinestyle{mystyle}{
% backgroundcolor=\color{backcolour},
% commentstyle=\color{codegreen},
% keywordstyle=\color{magenta},
% numberstyle=\tiny\color{codegray},
% stringstyle=\color{codepurple},
basicstyle=\fontfamily{phv},%\footnotesize,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
keepspaces=true,
numbers=left,
numbersep=5pt,
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2
}
\lstset{style=mystyle}
\lstset{basicstyle=\fontfamily{phv}\selectfont}
\makeindex
\include{frontmatter/preamble} %place custom commands and macros here
\lstset{numbers=left,xleftmargin=2em,frame=single,framexleftmargin=1.5em}
\lstset{frame=shadowbox}
\lstset{showlines=false}
\frontmatter
\title{Title} %This is a placeholder titlepage, it will not be final.
\author{Author}
% \subtitle{Classic Elegant\LaTeX{} Template}
% \author{Author}
% \institute{Elegant\LaTeX{} Program}
% \date{April 9, 2022}
% \version{4.3}
% \bioinfo{Bio}{Information}
% \extrainfo{Victory won\rq t come to us unless we go to it. }
% \logo{logo-blue.png}
% \cover{cover.jpg}
% modify the color in the middle of titlepage
\definecolor{customcolor}{RGB}{32,178,170}
\colorlet{coverlinecolor}{customcolor}
\begin{document}
\maketitle
% \frontmatter
% \tableofcontents
% \mainmatter
% \include{frontmatter/dedication}
\cleardoublepage
\setcounter{page}{3} %previous pages will be \setcounter{page}{7} %previous pages will be reserved for frontmatter to be added in later.
\tableofcontents
\include{frontmatter/foreword}
\include{frontmatter/preface}
%\listoffigures
%\listoftables
%\include{frontmatter/contributor}
%\include{frontmatter/symbollist}
\mainmatter
\part{Introduction and Prerequisites}
%%%
% Chapter includes
%%%
\bibliographystyle{plain}
\bibliography{bibliography}
\printindex
\end{document}
答案1
对于布局,我在对 Elegant 类文件中的几何包的调用中计算并使用了以下尺寸:
\RequirePackage{geometry}
\ifdefstring{\ELEGANT@device}{normal}{
\geometry{
a4paper,
layoutsize={6.14in,9.30in},
total={336pt, 543pt},
paperwidth=21.6truecm,
paperheight=30.3truecm,
headheight=2.17cm,
headsep=4mm,
footskip=12mm,
layoutvoffset=35mm,
layouthoffset=30mm,
showcrop
}
\ifdefstring{\ELEGANT@marginpar}{margintrue}{
\geometry{
marginparwidth=48pt, marginparsep=12pt
}}{\relax}}{
\relax}
对于页眉和页脚,我恢复了一侧选项并使用了以下内容:
\renewcommand{\chaptermark}[1]{\def\thechaptername{#1}} \renewcommand{\sectionmark}[1]{\def\thesectionname{#1}}
\lhead{\ifodd\thepage{\thesection~\thesectionname}\else{\thechapter~\thechaptername}\fi} \cfoot{\thepage}
以下是最终的布局,看起来很接近: