几何包和一些其他页面尺寸规范

几何包和一些其他页面尺寸规范

我想知道该geometry包当前是否支持以下页面尺寸设置:
页面设置
这就是设置以下内容:

  1. 2=3(每项设置为1);
  2. 5=6(每个设置为 4.6 毫米),以及
  3. 1=4(每个设置为 1 英寸)。
    我尝试使用该命令\usepackage[ left=2.54cm, right=2.54cm, top=3cm, bottom=3cm, headheight = 3.5\baselineskip, headsep = 4.6mm, a4paper ]{geometry},但似乎不起作用。我需要帮助。如果该软件包目前不支持指示的长度,我希望维护者 @David Carlisle 和 @Hideo Umeki 正在努力实现这一点。到目前为止,使用该layout软件包,我需要调整的长度不可用,如下图所示:
    布局 1布局 2
    以下是我的 MWE:
% !TeX TS-program = pdflatex    
\documentclass[12pt,openany,twoside]{book}
\raggedbottom
\usepackage[ 
left=2.54cm,
right=2.54cm, 
top=3cm, 
bottom=3cm,
headheight = 3.5\baselineskip,
headsep = 4.6mm,
a4paper
]{geometry}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage[table]{xcolor}
\usepackage{graphicx}
\newcommand\HRule{\noindent\rule{\linewidth}{1.5pt}}
\usepackage{background}
\backgroundsetup{contents={}}
\usepackage{fancyhdr}
\usepackage{hhline} 

\usepackage{helvet}


\usepackage{tabularx}%      
\newcommand*\myheaderfooterfont{\sffamily\bfseries\selectfont}  

\newlength{\leftspace}% for sections <<<<<<<<<
\setlength{\leftspace}{20ex}%set

\newlength{\Lheader}
\renewcommand{\chaptermark}[1]{\markboth{\uppercase{#1}}{}}%  
\renewcommand{\sectionmark}[1]{\markright{\uppercase{#1}}}%

\fancypagestyle{fancy}{%
    \fancyhf{}  
    \fancyhead[OL]{\myheaderfooterfont%
        \ifnum\value{chapter}>0%
        \begin{tabularx}{\textwidth}{@{}lX}\uppercase{Chapter~\thechapter}&\raggedright\leftmark\end{tabularx}% changed <<<<<<<<<<
        \else\raggedright\leftmark\relax\fi}
    \fancyhead[ER]{\myheaderfooterfont%
        \settowidth{\Lheader}{\thesection\hspace*{12pt}\rightmark}  
        \ifnum\value{chapter}>0%
        \ifdim\Lheader>\linewidth%          
        \begin{tabularx}{\dimexpr\textwidth-\leftspace}{@{}lX} \thesection &\raggedright\rightmark\end{tabularx}%
        \else\begin{tabular}{@{}ll@{}} \thesection &\raggedright\rightmark\end{tabular}%
        \fi\else\hfill\raggedright\rightmark\relax\fi
    }% changed <<<<<
    
    \fancyfoot{}
    \fancyfoot[RE,RO]{\myheaderfooterfont\thepage}%last added<<<<<<<
    %<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<last added
    \renewcommand\headrule
    {{    \nointerlineskip \color{blue}\rule{0.33\headwidth}{2.5pt}%   <---
            \color{red}\rule{0.34\headwidth}{2.5pt}%    <---
            \color{orange}\rule{0.33\headwidth}{2.5pt}% <---
    }}
    %<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<last added
}

\fancypagestyle{plain}{%
    \fancyhf{}%
    \renewcommand\headrule
    {{   \color{blue}\rule{1\headwidth}{0pt}%         
    }}   
    \fancyfoot{}
    \fancyfoot[RE,RO]{\myheaderfooterfont\thepage} %last added<<<<<<  
}

\pagestyle{fancy}   
\renewcommand{\footrulewidth}{1pt}
\renewcommand{\footruleskip}{3pt}

\usepackage{showframe}

\usepackage[none]{hyphenat}
\raggedright %  important with  none hyphenat + none !!!!!!!!!!!!!!!!!
\usepackage{layout}
\begin{document} 
    
    \frontmatter
    \chapter*{ABC}
    
    \markboth{ABC1}{ABC2}
    
    eeeheeyeyeyeyeyeeyeye
    \section*{DEG}
    dddheheheheheheheehehehe
    \pagebreak
    \section*{KJ}
    ddhheheheheheehehehheheheheheh
    \pagebreak
    \section*{KDH}
    dhddhhehehehehehehehehehehe
    
    \mainmatter
    
    \chapter{ABCD ffhfgrhr ejejejeje fhfhfhf ehehehehe dhddhdhellgl rkttkgkhihi eeeejejwnwn hhlhlnnmgjgj rjrrjoaoaoao  }        
    eehehdhdhdhdddddd ddddddddddddddddddddd     
    
    \newpage                
    \section{Special keyboard characters gghthr rhrrhd fheheh fhehuw fhewiwi feiwiwd fiiwiwid fiiwiwi}  
    
    \LaTeX{} hasmany symbols at its disposal. The majority of them are within the mathematical domain as shown in \eqref{eq:1} and \eqref{eq:2}. The ten special keyboard characters are: \verb|#|, \verb|$|, \verb|%|, \verb|&|, \verb|~|, \verb|_|, \verb|^|, \verb|\| and  \verb|{}|. If you simply want the character to be printed just as any other letter, include a \verb|\ | in front of the character. For example, \verb|\$| will produce \verb|$| in your output.
    The exception to the rule is the \verb|\ | itself because \verb|\\ | has its own special meaning. A \verb|\ | is produced by typing \verb|$\backslash$| in your file.       
    \newpage        
    \section{Special keyboard characters}       
    Special keyboard characters dhgdgdg dgdgdgdg ggdgdgd egegegege dgddgdgd eggegegeg dgdgdgdgd egegegeg dggeieieirr tktii43iwje rfrhrhrhr gtktotyiyighgjgj fkf     
    \newpage        
    Special keyboard characters dhgdgdg dgdgdgdg ggdgdgd egegegege dgddgdgd eggegegeg dgdgdgdgd egegegeg dggeieieirr tktii43iwje rfrhrhrhr gtktotyiyighgjgj fkf
    
    \chapter{One short line}        
    \LaTeX{} has many symbols at its disposal. The majority of them are within the mathematical domain as shown in \eqref{eq:1} and \eqref{eq:2}. The ten special keyboard characters are: \verb|#|, \verb|$|, \verb|%|, \verb|&|, \verb|~|, \verb|_|, \verb|^|, \verb|\| and  \verb|{}|. If you simply want the character to be printed just as any other letter, include a \verb|\ | in front of the character. For example, \verb|\$| will produce \verb|$| in your output.
    The exception to the rule is the \verb|\ | itself because \verb|\\ | has its own special meaning. A \verb|\ | is produced by typing \verb|$\backslash$| in your file. 
    
    \section{Special keyboard characters}   
    Special keyboard characters dhgdgdg dgdgdgdg ggdgdgd egegegege dgddgdgd eggegegeg dgdgdgdgd egegegeg dggeieieirr tktii43iwje rfrhrhrhr gtktotyiyighgjgj fkf     
    \newpage        
    Special keyboard characters dhgdgdg dgdgdgdg ggdgdgd egegegege dgddgdgd eggegegeg dgdgdgdgd egegegeg dggeieieirr tktii43iwje rfrhrhrhr gtktotyiyighgjgj fkf     
    \newpage        
    Special keyboard characters dhgdgdg dgdgdgdg ggdgdgd egegegege dgddgdgd eggegegeg dgdgdgdgd egegegeg dggeieieirr tktii43iwje rfrhrhrhr gtktotyiyighgjgj fkf  
    \clearpage   
    \layout*
\end{document}

答案1

使用您的设置,我得到了非常正确的几何形状。您可以使用它\dimexpr来更精确地设置长度,因为您结合使用了英寸和毫米。

请注意,TeX 中的一点 (pt) 为 72.72 英寸,这可能与各种转换工具使用的点单位不同。

还要注意的是,TeX 内部使用 pt,因此其他单位的长度在某个时候都会被转换。如果你尝试将 pt 的长度重新转换为英寸,你可能会得到轻微的舍入误差。(但我想说,使用任何其他软件也会遇到这个问题。)

\documentclass[12pt,openany,twoside]{book}

\usepackage[ 
    a4paper,
    left=1in,
    right=1in, 
    top=\dimexpr 1in + 4.6mm \relax, 
    bottom=\dimexpr 1in + 4.6mm \relax,
    headsep=4.6mm,
    headheight=3\baselineskip,
    footskip=\dimexpr \baselineskip + 4.6mm \relax
]{geometry}

\usepackage{layout}

\begin{document} 
    
    Text width should be 210mm $-$ 1in $-$ 1n.
    
    \newlength{\testlength}
    \setlength{\testlength}{\paperwidth}
    \addtolength{\testlength}{-1in}
    \addtolength{\testlength}{-1in}
    This is about \the\testlength .
    
    Text width is in fact \the\textwidth .
    
    \bigskip
    
    Text height should be 297mm $-$ 1in $-$ 4.6mm $-$ 1in $-$ 4.6mm.
    
    \setlength{\testlength}{\paperheight}
    \addtolength{\testlength}{-1in}
    \addtolength{\testlength}{-4.6mm}
    \addtolength{\testlength}{-1in}
    \addtolength{\testlength}{-4.6mm}
    This is about \the\testlength .
    
    Text height is in fact \the\textheight .
    
\end{document}

在此处输入图片描述

相关内容