章節數超出頁邊距

章節數超出頁邊距

我是 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}

在此輸入影像描述 在此輸入影像描述 在此輸入影像描述

相關內容