Guest User

Untitled

a guest
Jun 20th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.44 KB | None | 0 0
  1. documentclass[12pt]{article}
  2.  
  3. usepackage[cp1250]{inputenc}
  4. usepackage{lmodern} % for the looks
  5. usepackage{biolinum} % for the looks
  6. usepackage[T1]{fontenc}
  7.  
  8. usepackage{etoolbox}
  9. usepackage{titletoc}
  10. usepackage[colorlinks,linktoc=none]{hyperref}
  11.  
  12.  
  13. newcounter{numSubSection}
  14. setcounter{numSubSection}{0}
  15.  
  16. gpreto{subsection}{%
  17. refstepcounter{numSubSection}}%
  18.  
  19.  
  20. titlecontents{section}[0pt]%
  21. {addvspace{6pt}sffamilybfseriesnormalsize%
  22. makebox[18pt][r]{%
  23. hyperlink{page.thecontentspage}{textbf{thecontentspage}}%
  24. hspace{6pt}}}%
  25. {makebox[30pt][r]{thecontentslabelhspace{12pt}}}%
  26. {makebox[30pt][r]{null}}%
  27. {}%
  28.  
  29.  
  30. makeatletter
  31.  
  32. newlength{TOCleftSkip}
  33. setlength{TOCleftSkip}{66pt}%
  34. newlength{TOCrightSkip}
  35. setlength{TOCrightSkip}{18pt}%
  36.  
  37. newtoggle{ifSub}
  38. togglefalse{ifSub}%
  39. newtoggle{ifSection}
  40. toggletrue{ifSection}%
  41. newcounter{RefSubSection}%
  42. setcounter{RefSubSection}{0}%
  43. renewcommand*theRefSubSection{@arabicc@RefSubSection}%
  44.  
  45. renewcommand*{tableofcontents}{%
  46. section*{contentsname}%
  47. addcontentsline{toc}{section}{contentsname}%
  48. toggletrue{ifSection}%
  49. setcounter{RefSubSection}{0}%
  50. @starttoc{toc}}%
  51.  
  52. gpreto{l@section}{%
  53. nottoggle{ifSection}
  54. {par%
  55. addtolength{leftskip}{-TOCleftSkip}%
  56. addtolength{rightskip}{-TOCrightSkip}%
  57. togglefalse{ifSub}}{}%
  58. toggletrue{ifSection}}%
  59.  
  60. renewcommand*{l@subsection}[2]{%
  61. stepcounter{RefSubSection}%
  62. toggletrue{ifSub}%
  63. iftoggle{ifSection}
  64. {togglefalse{ifSection}%
  65. addtolength{leftskip}{TOCleftSkip}%
  66. addtolength{rightskip}{TOCrightSkip}%
  67. noindent}%
  68. {unskipbegingroupupshapesmall textbullet~endgroup}%
  69. begingroup%
  70. upshapesmall#1 hyperlink{numSubSection.theRefSubSection}{textbf{#2}}%
  71. endgroup}%
  72.  
  73. renewcommand*{l@subsubsection}[2]{%
  74. iftoggle{ifSection}
  75. {togglefalse{ifSection}%
  76. addtolength{leftskip}{TOCleftSkip}%
  77. addtolength{rightskip}{TOCrightSkip}%
  78. noindent}%
  79. {iftoggle{ifSub}
  80. {togglefalse{ifSub}relax%
  81. unskipbegingroupupshapesmall: endgroup}%
  82. {unskipbegingroupitshapesmall, endgroup}}%
  83. begingroupitshapesmall#1endgroup}%
  84.  
  85. renewcommand*{numberline}[1]{}%
  86.  
  87. makeatother
  88.  
  89.  
  90. % solution ends here, code below is just for the example
  91. begin{document}
  92.  
  93. % Frontmatter - only unnumbered/unlabeled sections
  94. pagenumbering{roman}
  95. clearpage
  96. tableofcontents
  97.  
  98. clearpage
  99. section*{Preface}
  100. addcontentsline{toc}{section}{Preface}
  101.  
  102. clearpage
  103. section*{Another Preface}
  104. addcontentsline{toc}{section}{Another Preface}
  105.  
  106.  
  107. % Mainmatter - only numbered/labeled sections
  108. clearpage
  109. addtocontents{toc}{protectvspace{18pt}} % just some separation
  110. pagenumbering{arabic}
  111. %clearpage
  112. section{First}
  113. subsection{Australia}
  114. subsubsection{Alpha}
  115. subsubsection{Beta}
  116. subsubsection{Charlie}
  117. subsubsection{Delta}
  118. subsubsection{Echo}
  119. subsubsection{Foxtrot}
  120. subsection{Brazil}
  121. subsubsection{Golf}
  122. subsubsection{Hotel}
  123. subsubsection{India}
  124. subsection{Canada}
  125.  
  126. clearpage
  127. section{Second}
  128.  
  129. clearpage
  130. section{Third}
  131. subsection{Denmark}
  132. subsubsection{Juliet}
  133. subsubsection{Kilo}
  134. subsubsection{Lima}
  135. subsubsection{Mike}
  136. subsubsection{November}
  137. subsection{Egypt}
  138. subsubsection{Oscar}
  139. subsubsection{Papa}
  140. subsubsection{Quebec}
  141. subsubsection{Romeo}
  142.  
  143. clearpage
  144. section{Fourth}
  145. subsection{Georgia}
  146. subsubsection{Sierra}
  147. subsection{Haiti}
  148. subsubsection{Tango}
  149. subsubsection{Uniform}
  150. subsubsection{Victor}
  151. subsubsection{Whiskey}
  152. subsection{Iceland}
  153. subsection{Japan}
  154. subsubsection{X-ray}
  155. subsubsection{Yankee}
  156. subsubsection{Zulu}
  157. subsubsection{Alpha}
  158. subsubsection{Beta}
  159. subsubsection{Charlie}
  160. subsubsection{Delta}
  161. subsubsection{Echo}
  162. subsection{Kenya}
  163. subsubsection{Foxtrot}
  164. subsection{Laos}
  165. subsubsection{Golf}
  166. subsubsection{Hotel}
  167. subsubsection{India}
  168. subsubsection{Juliet}
  169. subsubsection{Kilo}
  170.  
  171.  
  172. end{document}
Add Comment
Please, Sign In to add comment