Advertisement
obernardovieira

Nice boxes listed

Mar 23rd, 2017
371
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Latex 1.15 KB | None | 0 0
  1. \documentclass[11pt,parskip=half,numbers=noenddot,bibliography=totoc,index=totoc,
  2.  listof=leveldown
  3. ]{scrbook}
  4.  
  5. \addtotoclist{loe}
  6. \newcounter{example}[chapter]
  7. \renewcommand{\theexample}{\thechapter.\arabic{example}}
  8. \newcommand{\listofloename}{List of Examples}
  9. \newcommand\listofexamples{\listoftoc{loe}}
  10. \setuptoc{loe}{chapteratlist,leveldown}
  11. \makeatletter
  12. \newcommand\l@example{\l@figure}
  13. \makeatother
  14.  
  15. \usepackage{tcolorbox}
  16. \newenvironment{example}[1]{%
  17.   \setlength\parfillskip{0pt plus 1fil}%
  18.   \begin{tcolorbox}[
  19.     before title={%
  20.       \refstepcounter{example}%
  21.       \addxcontentsline{loe}{section}[\theexample]{\ignorespaces #1}},
  22.     title=Example\ \theexample:\ \ignorespaces #1]%
  23. }{\end{tcolorbox}}
  24.  
  25. \begin{document}
  26. \chapter{First}
  27.  
  28. \begin{example}{First example.}
  29. \end{example}
  30. \begin{table}
  31. \caption{First graph.}
  32. \end{table}
  33.  
  34. \chapter{Second}
  35. \begin{example}{Second example.}
  36.     Very nice!
  37. \end{example}
  38. \begin{table}
  39. \caption{Second graph.}
  40. \end{table}
  41. \begin{example}{Third example.}
  42. \end{example}
  43. \begin{table}
  44. \caption{Third graph.}
  45. \end{table}
  46.  
  47. \chapter{Lists}
  48. \listoftables
  49. \listofexamples
  50. \end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement