심심풀이로 (하기에 너무 많은 시간을 쏟아 중간에 포기하려다가 그 시간이 아까워서 겨우) 만들어봤습니다.
\documentclass[a4paper]{memoir}
\usepackage{morewrites}
\usepackage{blindtext}
\usepackage{xparse}
\usepackage{hyperref}
\hypersetup{colorlinks=true}
\newcommand\chaptoc{toc\roman{chapter}}
\makeatletter
\renewcommand\memendofchapterhook{
\@input{\jobname.\chaptoc}
\if@filesw
\expandafter\newwrite\csname tf@\chaptoc\endcsname
\immediate\openout \csname tf@\chaptoc\endcsname \jobname.\chaptoc\relax
\fi
\bigskip
}
\makeatother
\ExplSyntaxOn
\RenewDocumentCommand\addcontentsline{mmm}{
\addtocontents{#1}{\protect\contentsline{#2}{#3}{\thepage}{\@currentHref}}
\str_if_eq:nnT {#1}{toc}
{
\str_if_eq:nnF {#2}{chapter}
{
\addtocontents{\chaptoc}{\protect\contentsline{#2}{#3}{\thepage}{\@currentHref}}
}
}
}
\NewDocumentCommand \makechapters { O{10} }
{
\int_step_function:nnnN {1}{1}{#1}{ \blinddocument }
}
\ExplSyntaxOff
\setsecnumdepth{subsection}
\settocdepth{subsection}
\begin{document}
\tableofcontents*
\makechapters
\end{document}
KTUG 한국 텍 사용자 그룹