bingxuan9112

模板嘍

Mar 12th, 2019
347
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Latex 3.90 KB | None | 0 0
  1. %註解的符號是'%',該行之後所有文字皆會被當成註解,不會被TeX編譯,是個重要的功能
  2. %單次課程的講義可用article
  3. \documentclass[12pt, a4paper]{report}
  4.  
  5. %%% 引入Package %%%
  6. \usepackage{fontspec}   % 加這個就可以設定字體
  7. \usepackage{type1cm}    % 設定fontsize用
  8. \usepackage[margin=3cm]{geometry} % 上下左右距離邊緣3cm
  9. \usepackage{amsmath,amsthm,amssymb} % 引入 AMS 數學環境
  10. \usepackage{yhmath}     % math symbol
  11. \usepackage{graphicx}   % 圖形插入用
  12. \usepackage[usenames, dvipsnames]{color} % 可以使用顏色
  13. \usepackage[unicode=true, bookmarksdepth=-1]{hyperref} % 超連結
  14. \usepackage{tabularx}   % 加強版 table
  15. \usepackage{enumerate}  % 加強版 enumerate
  16.  
  17. %%% 中文環境 %%%
  18. \usepackage{xeCJK} % 讓中英文字體分開設置
  19. % 設定中文為系統上的字型,而英文不去更動,使用原TeX字型。
  20. % 不同作業系統的字型名稱可能不同,請留意。
  21. \setCJKmainfont[AutoFakeBold=3,AutoFakeSlant=.4]{標楷體}
  22. \defaultCJKfontfeatures{AutoFakeBold=3,AutoFakeSlant=.4}
  23. \newCJKfontfamily\Kai{標楷體}
  24. \newCJKfontfamily\Hei{微軟正黑體}
  25. \newCJKfontfamily\NewMing{新細明體}
  26. % 這兩行一定要加,中文才能自動換行
  27. \XeTeXlinebreaklocale "zh"
  28. \XeTeXlinebreakskip = 0pt plus 1pt
  29.  
  30. %%% 頁面設定 %%%
  31. \usepackage{fancyhdr}   % 頁首頁尾
  32. \usepackage{titlesec}   % 設定section等的字體
  33. \usepackage{titling}    % 加強 title 功能
  34. \usepackage{lastpage}   % 辨識文章總頁數
  35. \setlength{\headheight}{15pt}  %with titling
  36. \setlength{\droptitle}{-1.5cm} %title 與上緣的間距
  37. \parindent=24pt %設定縮排的距離
  38. %\parskip=1ex   %設定行距
  39. %% 自定義頁面格式,可改成自己喜愛的配置 %%
  40. \fancypagestyle{std}{
  41.     \fancyhead[L]{Section \rightmark}                   % 頁首左
  42.     \fancyhead[C]{}                                     % 頁首中
  43.     \fancyhead[R]{資訊超讀書會}                           % 頁首右
  44.     \fancyfoot[L]{Author:~\theauthor}                   % 頁腳左
  45.     \fancyfoot[C]{}                                     % 頁腳中
  46.     \fancyfoot[R]{Page \thepage\ of \pageref{LastPage}} % 頁腳右
  47.     \renewcommand{\headrulewidth}{0.4pt}                % 頁首分隔線
  48.     \renewcommand{\footrulewidth}{0.4pt}                % 頁腳分隔線
  49. }
  50. \pagestyle{std} % 設定除了第一頁外的頁面格式
  51. \titleformat{\chapter}[block]
  52.  {\thispagestyle{std}\normalfont\huge\bfseries\centering}{\thechapter.}{1em}{\Huge}
  53. \titlespacing*{\chapter}{0pt}{-19pt}{0pt}
  54.  
  55. %%% 設定theorem, problem等的環境 %%%
  56. %% 自定義Style改用粗體,預設 remark style 是斜體 %%
  57. \newtheoremstyle{std}
  58.   {10pt}{16pt}      % 上下間距
  59.   {}                % 內文字體
  60.   {}                % 縮排
  61.   {\bf}             % 標頭字體
  62.   {.}               % 標頭後標點
  63.   {1em}             % 內文與標頭距離
  64.   {}                % 標頭規格
  65. \theoremstyle{std} % 設定環境Style
  66. %% Problem, theorem等的宣告 %%
  67. \newtheorem{ex}{Example}
  68. \newtheorem{pr}{Problem}
  69. \newtheorem{df}{Definition}
  70. \newtheorem{thr}{Theorem}
  71.  
  72. %% Custom Hyperlink %%
  73. \newcommand{\HREF}[2]{\textbf{\underline{\color{blue}{\href{#1}{#2}}}}}
  74. \newcommand{\rawHREF}[1]{\texttt{\underline{\href{#1}{#1}}}}
  75.  
  76. %%% C++ code listing %%%
  77. \usepackage{listings}
  78. \definecolor{dkgreen}{rgb}{0,0.6,0}
  79. \definecolor{gray}{rgb}{0.5,0.5,0.5}
  80. \definecolor{mauve}{rgb}{0.58,0,0.82}
  81. \lstset{frame=tb,
  82.  language=C++,
  83.  aboveskip=3mm,
  84.  belowskip=3mm,
  85.  showstringspaces=false,
  86.  columns=flexible,
  87.  basicstyle={\small\ttfamily},
  88.  numbers=left,
  89.  numberstyle=\tiny\color{gray},
  90.  keywordstyle=\color{blue},
  91.  commentstyle=\color{dkgreen},
  92.  stringstyle=\color{mauve},
  93.  breaklines=true,
  94.  breakatwhitespace=true,
  95.  tabsize=4
  96. }
  97. \newcommand{\cppcode}{\lstinputlisting[language=C++]}
  98.  
  99. %%% 以上為主要不動處 %%%
  100. \title{這是模板}
  101. \author{我是作者}
  102. \date{\today} %可不加日期
  103.  
  104. \begin{document}
  105. \maketitle % 顯示標題
  106. \thispagestyle{std} %使用fancyhdr(預設第一頁不會使用)
  107. %%% 引入內容檔案 %%%
  108. \input{content}
  109. %%%%%%%%%%%%%%%%%%
  110. \end{document}
Advertisement
Add Comment
Please, Sign In to add comment