template_book.latex 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. % BETTER ERROR MESSAGES
  2. \errorcontextlines 10000
  3. % DOCUMENT ATTRIBUTES
  4. \documentclass[10pt, a4paper, parskip=full, openany, twoside]{book}
  5. % 12pt : main font size
  6. % a4paper : paper format
  7. % parskip=full : ???
  8. % openany : no need for an additional (second) pagebreak after a chapter to move new chapters always to the right page
  9. \usepackage[
  10. top=25mm,
  11. bottom=25mm,
  12. left=25mm,
  13. right=25mm,
  14. bindingoffset=10mm,
  15. heightrounded,
  16. ]{geometry}
  17. % HEADER AND FOOTER
  18. \usepackage{fancyhdr}
  19. \pagestyle{fancy}
  20. \fancyhf{}
  21. \fancyhead[LE,RO]{杨小龙}
  22. \fancyhead[CE,CO]{Deutsch Übungen}
  23. \fancyhead[RE,LO]{}
  24. \fancyfoot[LE,RO]{样小龙}
  25. \fancyfoot[CE,CO]{\thepage{}}
  26. \fancyfoot[LE,RO]{}
  27. % make chapter pages use the empty page style as well
  28. \usepackage{etoolbox}
  29. \patchcmd{\chapter}{plain}{fancy}{}{}
  30. \patchcmd{\part}{plain}{fancy}{}{}
  31. % MATH MODE
  32. \usepackage{amsmath}
  33. % define a command for phrases without breaks
  34. \def\nonbreaking{\hfil\penalty 100 \hfilneg \hbox}
  35. % FIX FOR PANDOC 1.14 and later
  36. \providecommand{\tightlist}{\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
  37. % DOCUMENT META INFORMATION
  38. $if(title)$\title{$title$}$endif$
  39. $if(author)$\author{$author$}$endif$
  40. \date{\today}
  41. % TABLE OF CONTENTS
  42. % styling for article document class
  43. \usepackage{tocloft}
  44. \usepackage[dotinlabels]{titletoc}
  45. \makeatletter
  46. \renewcommand*\l@section{\@dottedtocline{1}{1.5em}{2.3em}}
  47. \makeatother
  48. \setcounter{tocdepth}{1}
  49. \setcounter{secnumdepth}{1}
  50. \cftsetindents{chapter}{0mm}{2em}
  51. \cftsetindents{section}{0mm}{2em}
  52. % \cftsetindents{subsection}{0mm}{35mm}
  53. % \cftsetindents{subsubsection}{0mm}{45mm}
  54. % \cftsetindents{paragraph}{0mm}{55mm}
  55. % EURO Symbol
  56. \usepackage{eurosym}
  57. % FONT
  58. \usepackage{fontspec,xunicode}
  59. \usepackage[UTF8]{ctex}
  60. \setCJKmainfont[Scale=1.0]{WenQuanYi Micro Hei}
  61. % AUTOMATICAL PINYIN PHONETIC SCRIPT
  62. \newfontfamily{\DVS}{DejaVu Sans}
  63. \usepackage{xpinyin}
  64. \xpinyinsetup{ratio={.7}, hsep={.5em plus .1em}, vsep={1.1em}, multiple={\color{red}}, pysep={.2em}, font=\DVS}
  65. \defaultfontfeatures{Mapping=tex-text, Scale=MatchLowercase} % what does this do? -- influences how quotes are rendered
  66. \setmainfont[Scale=1]{OpenSans-Regular.ttf}
  67. \setmonofont{Liberation Mono}
  68. \DeclareMathSizes{14}{12}{9}{7}
  69. %\DeclareMathSizes{<surrounding text size>}{<math text size>}{<math script size>}{<math scriptscript size>}.
  70. % LIST ITEMS on the same page
  71. \usepackage{etoolbox}
  72. \preto\subitem{\leavevmode\vadjust{\penalty10000}}
  73. % TABLES
  74. \usepackage{longtable}
  75. \usepackage{booktabs}
  76. \usepackage{multirow}
  77. \usepackage{tabu}
  78. \tabulinesep=10pt
  79. % \usepackage{array}
  80. \newcommand{\ra}[1]{\renewcommand{\arraystretch}{#1}}
  81. % \makeatletter
  82. % \newcommand{\thickhline}{%
  83. % \noalign {\ifnum 0=`}\fi \hrule height 1pt
  84. % \futurelet \reserved@a \@xhline
  85. % }
  86. % \newcolumntype{[}{@{\vrule width 1pt\hspace{6pt}}}
  87. % \newcolumntype{]}{@{\hspace{6pt}\vrule width 1pt}}
  88. % \newcolumntype{!}{@{\hskip\tabcolsep\vrule width 1pt\hskip\tabcolsep}}
  89. % \makeatother
  90. % PREDEFINED COLORS
  91. \usepackage[dvipsnames]{xcolor}
  92. % LINKS
  93. \usepackage{hyperref}
  94. \hypersetup{
  95. colorlinks=true,
  96. urlcolor=CadetBlue,
  97. filecolor=Gray,
  98. citecolor=Black,
  99. linkcolor=Black
  100. }
  101. % FIGURES (wrapping text around figures, ...)
  102. \usepackage{wrapfig}
  103. \usepackage{float}
  104. \usepackage{chngcntr}
  105. \counterwithout{figure}{chapter}
  106. \counterwithout{footnote}{chapter}
  107. % PARAGRAPH FORMATTING
  108. \setlength\parindent{0pt}
  109. % LANGUAGE SETTINGS (important for automatic breaking words)
  110. \usepackage[english, ngerman]{babel} % the last language in this line will be default for the document
  111. \selectlanguage{ngerman}
  112. % LAST PAGE NUMBER AVAILABILITY
  113. \usepackage{lastpage}
  114. \usepackage{titlesec} % Textüberschriften anpassen
  115. \titleformat{\chapter}[hang]{\LARGE\bfseries}{\thechapter.\quad}{0pt}{}{}
  116. \titleformat{\section}[hang]{\Large\bfseries}{\thesection.\quad}{0pt}{}
  117. \titleformat{\subsection}[hang]{\large\bfseries}{\thesubsection.\quad}{0pt}{}
  118. \titleformat{\subsubsection}[hang]{\large}{\thesubsubsection\quad}{0pt}{}
  119. \titleformat{\paragraph}[hang]{\normalsize}{\theparagraph\quad}{0pt}{}
  120. \titlespacing{\chapter}{0pt}{-3em}{6pt}
  121. \titlespacing{\section}{0pt}{6pt}{6pt}
  122. \titlespacing{\subsection}{0pt}{6pt}{6pt}
  123. \titlespacing{\subsubsection}{0pt}{6pt}{6pt}
  124. \setlength{\parskip}{\baselineskip}
  125. %\titlespacing{\paragraph}{0pt}{6pt}{6pt}
  126. % Font size command
  127. \makeatletter
  128. \newcommand{\showfontsize}{\f@size{} pt}
  129. \makeatother
  130. % my own commands
  131. % needs multido, or orthers, so getting those packages:
  132. \newcommand{\gapunit}{.....}
  133. \newcommand{\tinygap}{\gapunit}
  134. % \usepackage{multido}
  135. % \newcommand{\rpt}[3]{%
  136. % \newcount\iterations%
  137. % \iterations #1%
  138. % \advance\iterations -1
  139. % \multido{\iN=0+1}{\iterations}{#2#3}#2%
  140. % }
  141. % ===== EGREG VARIANT =====
  142. \makeatletter
  143. \newcount\my@repeat@count% initialize a new counter for the loop
  144. \newcommand{\myrepeat}[3]{% new command with 2 arguments
  145. \begingroup% using a group here allows nested calls
  146. \my@repeat@count=1% initialize at 1, so that there are argument - 1 iterations and the last iterations doesn't have a separator following it
  147. \@whilenum\my@repeat@count<#1\do{#2#3\advance\my@repeat@count1}#2% as long as the iteration count is smaller than the argument, advance, meaning that the counter will be increased by 1
  148. \endgroup%
  149. }
  150. \makeatother
  151. \newcommand{\shortgap}{%
  152. \myrepeat{3}{\gapunit}{\ }
  153. }
  154. \newcommand{\mediumgap}{%
  155. \myrepeat{5}{\gapunit}{\ }
  156. }
  157. \newcommand{\longgap}{%
  158. \myrepeat[10]{\gapunit}{\ }
  159. }
  160. % ===== Christian Hupfer VARIANT =====
  161. % \newcount\myloopcounter
  162. % \newcommand{\repeatit}[3][10]{%
  163. % \myloopcounter1% initialize the loop counter
  164. % \loop\ifnum\myloopcounter < #1
  165. % #2#3%
  166. % \advance\myloopcounter by 1%
  167. % \repeat% start again
  168. % #2%
  169. % }
  170. % ==============================
  171. % ========== DOCUMENT ==========
  172. % ==============================
  173. \begin{document}
  174. \frontmatter
  175. $if(title)$\maketitle$endif$
  176. \setcounter{page}{1} % page numbering should start at 1 at TOC
  177. \pagestyle{empty} % remove header and footer from empty page after TOC
  178. $if(toc)$\tableofcontents$endif$
  179. \mainmatter
  180. \pagestyle{fancy}
  181. \renewcommand{\baselinestretch}{1.3}
  182. % FOOTER
  183. \fancyfoot[LE,RO]{杨小龙}
  184. \fancyfoot[CE,CO]{Seite \thepage{} von \pageref{LastPage}}
  185. \fancyfoot[LE,RO]{}
  186. $body$
  187. \newpage
  188. \listoffigures
  189. \newpage
  190. \listoftables
  191. \end{document}