我正在為我的論文使用自訂文件類別和範本。兩者都可以在這裡找到(它們真的很長,否則我會複製並貼上):https://wiki.cites.illinois.edu/wiki/display/ECEThesisReview/LaTeX+Resources
這是我的問題:我使用設定邊距
\usepackage{geometry}
\geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in}
每當我聲明該選項時
\documentclass[12pt,tocnosub,fancy,offcenter]{uiucecethesis09}
在序言中,章節號違反了我的學院論文規則,即任何內容都不得延伸到一吋的頁邊距。
如何修改類文件,使章節編號位於一英寸邊距內,即將章節編號和標題移動大約一英寸,使其與一英寸邊距對齊?
答案1
「有問題的」程式碼是巨集中的分支內的程式碼\llap
,\@makechapterhead
導致\if@thesisfancy
左側縮排到頁邊距。這可以透過在相關位置應用補丁來刪除。
編輯如果章節標題長於文字寬度(減去章節編號圖的寬度),則此方法不起作用(到目前為止)
\documentclass[12pt,tocnosub,fancy,offcenter]{uiucecethesis09}
\usepackage{geometry}
\geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in}
\usepackage{blindtext}
\usepackage{xpatch}
\makeatletter
\xpatchcmd{\@makechapterhead}{\leavevmode\llap}{\leavevmode}{}{}
\makeatother
\begin{document}
\chapter{First}
\blindtext
\end{document}
答案2
這只是對克里斯蒂安·胡普弗(christian Hupfer)答案的補充,以防章節標題很長(但我認為這是個壞主意:大寫的長文本)
\documentclass[12pt,tocnosub,fancy,offcenter]{uiucecethesis09}
\usepackage{geometry}
\geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in}
\usepackage{blindtext}
\usepackage{xpatch}
\makeatletter
\xpatchcmd{\@makechapterhead}{\leavevmode\llap}{\leavevmode}{}{}
\xpatchcmd{\@makechapterhead}{\chaptertitlefont \capchaptitle}{\parbox{.85\textwidth}{\chaptertitlefont \capchaptitle}}{}{}
\makeatother
\begin{document}
\chapter{First}
\blindtext
\end{document}