ページの交互の側に段落番号を付ける

ページの交互の側に段落番号を付ける

私は現在、段落番号を付ける必要がある論文を準備しています。私の目的には、以下のようなものがうまく機能しています。

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

関連情報