页面两侧的段落编号

页面两侧的段落编号

我目前正在准备一篇必须按段落编号的论文。以下内容对我来说很合适,有点像:

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

相关内容