KTUG 한국 텍 사용자 그룹

Menu

KTUG :: 마당자유글 › chpater toc

yihoze | 2015.10.15 11:51:27 | 메뉴 건너뛰기 쓰기

심심풀이로 (하기에 너무 많은 시간을 쏟아 중간에 포기하려다가 그 시간이 아까워서 겨우) 만들어봤습니다. 


chaptertoc.PNG


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

첨부 [1]

댓글 [3]

댓글 쓰기

목록

KTUG 한국 텍 사용자 그룹