Skip to content

Instantly share code, notes, and snippets.

@motchy869
Created February 18, 2017 15:29
Show Gist options
  • Save motchy869/3f88dc4c5b2086fc212affe6a82b7e6d to your computer and use it in GitHub Desktop.
Save motchy869/3f88dc4c5b2086fc212affe6a82b7e6d to your computer and use it in GitHub Desktop.
部番号表示
\documentclass[a4paper]{jsarticle}
%section, subsection, subsubsection の先頭に部番号が付くようにする
\makeatletter
\@addtoreset{section}{part}\renewcommand{\thesection}{\thepart.\arabic{section}}
\@addtoreset{subsection}{section}\renewcommand{\thesubsection}{\thesection.\arabic{subsection}}
\@addtoreset{subsubsection}{subsection}\renewcommand{\thesubsubsection}{\thesubsection.\arabic{subsubsection}}
\makeatother
\begin{document}
\title{部番号なし}
\author{motchy}
\maketitle
\part{A}
\section{B}
\subsection{C}
\label{subsec:C}
Alpha Bravo Charlie
\part{い}
\setcounter{section}{0}
\section{ろ}
\subsection{は}
\label{subsec:は}
いろは にほへと ちりぬるを
\part{ほげ}
\setcounter{section}{0}
\section{ふが}
\subsection{ぴよ}
\ref{subsec:C}, \ref{subsec:は} より...
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment