init.el 5.5 KB

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