init.el 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. ;; NOTE: THIS FILE CONTAINS PARTS OF THE REQUIRED EMACS INIT.EL FILE
  2. ;; FOR BUILDING THE PDF. IT IS NOT A STANDALONE THING.
  3. ;; ==========================
  4. ;; ORG-MODE SPECIFIC SETTINGS
  5. ;; ==========================
  6. (require 'org)
  7. (require 'ox-latex)
  8. ;; Setup for exporting to PDF using Xelatex First you need to define a
  9. ;; document class, which will be referred to later, that has all the
  10. ;; definitions required to compile the PDF.
  11. ;; EXAMPLE
  12. (with-eval-after-load 'ox-latex
  13. (add-to-list 'org-latex-classes
  14. '("org-book"
  15. "
  16. \\documentclass[12pt, a4paper, openany, twoside]{book}
  17. \\usepackage[vmargin=2cm,
  18. rmargin=2cm,
  19. lmargin=2cm,
  20. bindingoffset=1cm]{geometry}
  21. \\usepackage[UTF8]{ctex}
  22. \\usepackage[autostyle=true]{csquotes} % modify quotes
  23. \\usepackage{amsmath}
  24. \\usepackage{amssymb}
  25. \\usepackage{mathtools}
  26. \\usepackage{hyperref}
  27. %%%%%%%%%%%%%%%%
  28. %%%%% IMAGES %%%%%
  29. %%%%%%%%%%%%%%%%
  30. \\usepackage{caption}
  31. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  32. %%%%% BIBLIOGRAPHY AND CITING %%%%%
  33. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  34. \\usepackage[square,sort,comma,numbers]{natbib}
  35. \\bibliographystyle{alphadin} %% does not work with biblatex
  36. \\renewcommand*{\\bibfont}{\\raggedright}
  37. %%%%%%%%%%%%%%%%%%%%%%%%%%%
  38. %%%%% TABLE OF CONTENTS %%%%%
  39. %%%%%%%%%%%%%%%%%%%%%%%%%%%
  40. % styling for article document class
  41. % \\usepackage{tocloft}
  42. \\usepackage[rightlabels, dotinlabels]{titletoc}
  43. \\setcounter{chapter}{1}
  44. % level of depth of table of contents and section numberings
  45. \\setcounter{tocdepth}{2}
  46. \\setcounter{secnumdepth}{2}
  47. %%%%%%%%%%%%%%%%%%%%%%%%%%%%
  48. %%%%%% LANGUAGE SETTINGS %%%%%
  49. %%%%%%%%%%%%%%%%%%%%%%%%%%%%
  50. %% NOTE: happens in each document, not in this template
  51. % (important for automatic breaking words)
  52. % \\selectlanguage{ngerman}
  53. % \\selectlanguage{USenglish}
  54. %%%%%%%%%%%%%%%%%%%%
  55. %%%%% PAGE STYLE %%%%%
  56. %%%%%%%%%%%%%%%%%%%%
  57. \\raggedbottom
  58. \\pagestyle{empty}
  59. \\title{}
  60. [NO-DEFAULT-PACKAGES]
  61. [NO-PACKAGES]
  62. %%%%%%%%%%%%%%%%%%
  63. %%%%% HEADINGS %%%%%
  64. %%%%%%%%%%%%%%%%%%
  65. \\usepackage{titlesec}
  66. \\titleformat{\\chapter}[hang]{\\fontsize{22pt}{23pt}\\bfseries}{\\thechapter.\\quad}{0pt}{}{}
  67. \\titleformat{\\section}[hang]{\\fontsize{16pt}{17pt}\\bfseries}{\\thesection.\\quad}{0pt}{}
  68. \\titleformat{\\subsection}[hang]{\\fontsize{14pt}{15pt}\\bfseries}{\\thesubsection.\\quad}{0pt}{}
  69. \\titleformat{\\subsubsection}[hang]{\\fontsize{13pt}{14pt}\\bfseries}{\\thesubsubsection\\quad}{0pt}{}
  70. \\titleformat{\\paragraph}[hang]{\\normalsize\\bfseries}{\\theparagraph\\quad}{0pt}{}
  71. %%%%%%%%%%%%%%%%%%%
  72. %%%%% MATH MODE %%%%%
  73. %%%%%%%%%%%%%%%%%%%
  74. \\newcommand{\\Hsquare}{%
  75. \\text{\\fboxsep=-.15pt\\fbox{\\rule{0pt}{.75ex}\\rule{.75ex}{0pt}}}%
  76. }
  77. \\newcommand{\\divides}{\\mid}
  78. \\newcommand{\\notdivides}{\\nmid}
  79. \\newcommand{\\setR}{\\mathbb{R}}
  80. \\newcommand{\\setQ}{\\mathbb{Q}}
  81. \\newcommand{\\setZ}{\\mathbb{Z}}
  82. \\newcommand{\\setN}{\\mathbb{N}}
  83. \\usepackage{etoolbox}% for '\\AtBeginEnvironment' macro
  84. \\AtBeginEnvironment{pmatrix}{\\everymath{\\displaystyle}}
  85. \\AtBeginEnvironment{bmatrix}{\\everymath{\\displaystyle}}
  86. \\AtBeginEnvironment{matrix}{\\everymath{\\displaystyle}}
  87. \\AtBeginEnvironment{array}{\\everymath{\\displaystyle}}
  88. % absolute value
  89. \\DeclarePairedDelimiter\\abs{\\lvert}{\\rvert}
  90. \\DeclarePairedDelimiter\\norm{\\lVert}{\\rVert}
  91. % Swap the definition of \\abs* and \\norm*, so that \\abs
  92. % and \\norm resizes the size of the brackets, and the
  93. % starred version does not.
  94. \\makeatletter
  95. \\let\\oldabs\\abs
  96. \\def\\abs{\\@ifstar{\\oldabs}{\\oldabs*}}
  97. %
  98. \\let\\oldnorm\\norm
  99. \\def\\norm{\\@ifstar{\\oldnorm}{\\oldnorm*}}
  100. \\makeatother
  101. \\newcommand*\\colvec[1]{
  102. \\begin{pmatrix}
  103. #1
  104. \\end{pmatrix}
  105. }
  106. %%%%%%%%%%%%%%%%%%%%%%%%%%%
  107. %%%%% PREDEFINED COLORS %%%%%
  108. %%%%%%%%%%%%%%%%%%%%%%%%%%%
  109. \\usepackage{color}
  110. \\usepackage[table]{xcolor}
  111. \\definecolor{quotecolor}{HTML}{686868}
  112. \\definecolor{White}{RGB}{255, 255, 255}
  113. \\definecolor{Black}{RGB}{0, 0, 0}
  114. \\definecolor{tableHeader}{RGB}{211, 47, 47}
  115. \\definecolor{tableLineOdd}{RGB}{245, 245, 245}
  116. \\definecolor{tableLineEven}{RGB}{224, 224, 224}
  117. \\definecolor{linkgray}{RGB}{100, 100, 100}
  118. \\definecolor{CadetBlue}{RGB}{110, 106, 156}
  119. %%%%%%%%%%%%%%%%%%%
  120. %%%%% FOOTNOTES %%%%%
  121. %%%%%%%%%%%%%%%%%%%
  122. \\makeatletter
  123. \\def\\@footnotecolor{red}
  124. \\define@key{Hyp}{footnotecolor}{%
  125. \\HyColor@HyperrefColor{#1}\\@footnotecolor%
  126. }
  127. \\patchcmd{\\@footnotemark}{\\hyper@linkstart{link}}{\\hyper@linkstart{footnote}}{}{}
  128. \\makeatother
  129. %%%%%%%%%%%%%%%
  130. %%%%% FONTS %%%%%
  131. %%%%%%%%%%%%%%%
  132. \\setCJKmainfont[Scale=1.0]{WenQuanYi Micro Hei}
  133. \\setmainfont[Scale=1]{Ubuntu}
  134. \\setmonofont{Liberation Mono}
  135. \\DeclareMathSizes{14}{12}{10}{8}
  136. %%%%%%%%%%%%%%%%%%%%
  137. %%%%% HYPERLINKS %%%%%
  138. %%%%%%%%%%%%%%%%%%%%
  139. %% DEPENDENCIES: FOOTNOTES block
  140. \\hypersetup{
  141. colorlinks=true,
  142. urlcolor=CadetBlue,
  143. filecolor=linkgray,
  144. citecolor=blue,
  145. linkcolor=linkgray,
  146. footnotecolor=blue
  147. }
  148. \\urlstyle{same}
  149. %%%%%%%%%%%%%%%%%%%
  150. %%%%% ALIGNMENT %%%%%
  151. %%%%%%%%%%%%%%%%%%%
  152. % default is justified alignment
  153. %%%%%%%%%%%%%%%%%%%%%
  154. %%%%% HYPHENATION %%%%%
  155. %%%%%%%%%%%%%%%%%%%%%
  156. \\pretolerance=5000
  157. \\tolerance=9000
  158. \\emergencystretch=0pt
  159. \\righthyphenmin=2
  160. \\lefthyphenmin=4
  161. "
  162. ("\\chapter{%s}" . "\\chapter*{%s}")
  163. ("\\section{%s}" . "\\section*{%s}")
  164. ("\\subsection{%s}" . "\\subsection*{%s}")
  165. ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
  166. ("\\paragraph{%s}" . "\\paragraph*{%s}")
  167. ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))))
  168. (setq org-latex-pdf-process
  169. '("xelatex -interaction nonstopmode %f"
  170. "xelatex -interaction nonstopmode %f")) ;; for multiple passes