init.el 4.7 KB

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