頁面交替兩側的段落編號

頁面交替兩側的段落編號

我目前正在準備一篇必須有段落編號的論文。下面的內容對於我的目的來說工作得很好,有點:

\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}

相關內容