
我目前正在準備一篇必須有段落編號的論文。下面的內容對於我的目的來說工作得很好,有點:
\documentclass[12pt, twoside]{book}
\newcounter{chapcount}[chapter]
\newcounter{parnum}
\newlength{\parnumwidth}
\setlength{\parnumwidth}{4em}
\newcommand{\N}{%
\noindent\refstepcounter{chapcount}%
\makebox[0pt][r]{\makebox[\parnumwidth][l]{\textbf{\arabic{chapter}-
\arabic{chapcount}}}}%
\hspace*{\parindent}\ignorespaces}
\setlength{\parindent}{0em}
\begin{document}
\chapter{Introduction}
\N This is a numbered paragraph.
\N This is another paragraph.
\end{document}
不過,我想知道是否可以在左頁的左頁邊距和右頁的右頁邊距中進行編號——這是教科書等相當常見的佈局:
答案1
您可以使用\marginpar
內建此功能的產品。
\documentclass[12pt, twoside]{book}
\newcounter{chapcount}[chapter]
\renewcommand\thechapcount{\thechapter.\arabic{chapcount}}
\newcommand{\N}{%
\par
\noindent\refstepcounter{chapcount}%
\marginpar[\raggedleft \textbf{\thechapcount}]{\raggedright \textbf{\thechapcount}}}
\setlength{\parindent}{0em}
\begin{document}
\chapter{Introduction}
\N This is a numbered paragraph.
\N This is another paragraph.
\clearpage
\N This is a numbered paragraph.
\N This is another paragraph.
\end{document}