章节号移出边距

章节号移出边距

我是 LaTeX 新手,遇到了一个问题。图片说明了一切...当我的章节数超过 9 时,第二位数字会移出边距....

第 10 章中的数字 0 移出了边距!!

我已经将以下布局从网络上复制到我的序言中的章节中:

\documentclass[a4paper,11pt,twoside,openright]{memoir}

\usepackage{xcolor}

\definecolor{numbercolor}{gray}{0.7}
\newif\ifchapternonum

\makechapterstyle{jenor}{
  \renewcommand\printchaptername{}
  \renewcommand\printchapternum{}
  \renewcommand\printchapternonum{\chapternonumtrue}
  \renewcommand\chaptitlefont{\fontfamily{pbk}\fontseries{db}\fontshape{n}\fontsize{25}{35}\selectfont\raggedleft}
  \renewcommand\chapnumfont{\fontfamily{pbk}\fontseries{m}\fontshape{n}\fontsize{1in}{0in}\selectfont\color{numbercolor}}
  \renewcommand\printchaptertitle[1]{%
    \noindent
    \ifchapternonum
    \begin{tabularx}{\textwidth}{X}
    {\let\\\newline\chaptitlefont ##1\par}
    \end{tabularx}
    \par\vskip-2.5mm\hrule
    \else
    \begin{tabularx}{\textwidth}{Xl}
    {\parbox[b]{\linewidth}{\chaptitlefont ##1}} & \raisebox{-15pt}{\chapnumfont \thechapter}
    \end{tabularx}
    \par\vskip2mm\hrule
    \fi
  }
}

\chapterstyle{jenor}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\usepackage{pdfsync}    
\setlrmarginsandblock{5.5cm}{2.5cm}{*}  
\setulmarginsandblock{2.5cm}{3.0cm}{*}
\checkandfixthelayout 

\begin{document}


\setcounter{chapter}{9}

\chapter{diskussion}
Test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test 
\end{document}

有人能给我一些解决方案或建议吗?如果有的话,我将不胜感激!

答案1

这只是一条较长的评论。此 MWE 未显示在图片中,因此请复制此评论并添加到其中,以便显示您的问题

\documentclass[a4paper]{memoir}
\usepackage{xcolor}

\definecolor{numbercolor}{gray}{0.7}
\newif\ifchapternonum

\makechapterstyle{jenor}{
  \renewcommand\printchaptername{}
  \renewcommand\printchapternum{}
  \renewcommand\printchapternonum{\chapternonumtrue}
  \renewcommand\chaptitlefont{\fontfamily{pbk}\fontseries{db}\fontshape{n}\fontsize{25}{35}\selectfont\raggedleft}
  \renewcommand\chapnumfont{\fontfamily{pbk}\fontseries{m}\fontshape{n}\fontsize{1in}{0in}\selectfont\color{numbercolor}}
  \renewcommand\printchaptertitle[1]{%
    \noindent
    \ifchapternonum
    \begin{tabularx}{\textwidth}{X}
    {\let\\\newline\chaptitlefont ##1\par}
    \end{tabularx}
    \par\vskip-2.5mm\hrule
    \else
    \begin{tabularx}{\textwidth}{Xl}
    {\parbox[b]{\linewidth}{\chaptitlefont ##1}} & \raisebox{-15pt}{\chapnumfont \thechapter}
    \end{tabularx}
    \par\vskip2mm\hrule
    \fi
  }
}

\chapterstyle{jenor}

\begin{document}


\setcounter{chapter}{9}

\chapter{diskussion}

\end{document}

请注意,此图像使用已发布的代码是如何实现的不是最终与原始图像一样。所以一定有其他事情发生。

在此处输入图片描述


这个设计怎么样

\documentclass[a4paper,11pt,twoside,openright]{memoir}

\usepackage{xcolor,kantlipsum}

\setlrmarginsandblock{5.5cm}{2.5cm}{*}  
\setulmarginsandblock{2.5cm}{3.0cm}{*}
\checkandfixthelayout 



\definecolor{numbercolor}{gray}{0.7}
\newif\ifchapternonum


\newlength\chapnumwidth

\makechapterstyle{jenor}{
  \renewcommand\printchaptername{}
  \renewcommand\printchapternum{}
  \renewcommand\printchapternonum{\chapternonumtrue}
  \renewcommand\chaptitlefont{\fontfamily{pbk}\fontseries{db}\fontshape{n}\fontsize{25}{35}\selectfont\raggedleft}
  \renewcommand\chapnumfont{\fontfamily{pbk}\fontseries{m}\fontshape{n}\fontsize{1in}{0in}\selectfont\color{numbercolor}}
  \settowidth\chapnumwidth{\chapnumfont 99}
  \renewcommand\printchaptertitle[1]{%
    \noindent
    % design only good for chapters in right hand pages
    \begin{adjustwidth}{0em}{-4em}
      \ifchapternonum
      % use this if the un-numbered placement should match 100%
      % \begin{tabularx}{\linewidth}{Xp{\chapnumwidth}}
      %   {\parbox[b]{\linewidth}{\chaptitlefont ##1}} &
      %   \raisebox{-15pt}{\phantom{\chapnumfont 99}}
      \begin{tabularx}{\textwidth}{@{}X@{}}
        {\parbox[b]{\linewidth}{\chaptitlefont ##1}}
        \\
        \addlinespace[0.5em]
        \cmidrule{1-1}
      \end{tabularx}
      \else
      \begin{tabularx}{\linewidth}{@{}Xp{\chapnumwidth}@{}}
        {\parbox[b]{\linewidth}{\chaptitlefont ##1}} &
        \raisebox{-15pt}{\chapnumfont \thechapter}
        \\
        \addlinespace[0.5em]
        \cmidrule{1-1}
      \end{tabularx}
      \fi
    \end{adjustwidth}
  }
}

\chapterstyle{jenor}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\begin{document}

\chapter*{diskussion}

\kant[3]

\setcounter{chapter}{8}

\chapter{diskussion}

\kant[3]


\setcounter{chapter}{9}

\chapter{diskussion}

\kant[3]


\end{document}

在此处输入图片描述 在此处输入图片描述 在此处输入图片描述

相关内容