\documentclass{article} %%%%%%%%%%%%%%%%% **# chinese setting #** %%%%%%%%%%%%%%%%%% \usepackage{fontspec} \usepackage{xeCJK} %讓中英文字體分開設置 \defaultCJKfontfeatures{AutoFakeBold=6,AutoFakeSlant=.4} %以後不用再設定粗斜 \XeTeXlinebreaklocale "zh" %這兩行一定要加 \XeTeXlinebreakskip = 0pt plus 1pt %中文才能自動換 \newCJKfontfamily{\Kai}{標楷體} \newCJKfontfamily{\Hei}{微軟正黑體} \newCJKfontfamily{\Wen}{文泉驛等寬微米黑} \setCJKmainfont{文泉驛等寬微米黑} %%%%%%%%%%%%%%%%%% **# border, indent #** %%%%%%%%%%%%%%%%%% \usepackage{geometry} \geometry{a4paper} \geometry{left=1.7cm, right=1.7cm, top=2cm, bottom=2cm} \linespread{1} \setlength{\parskip }{0.5em} \setlength{\parindent }{ 2em} %%%%%%%%%%%%%%%%%% **# header, footer #** %%%%%%%%%%%%%%%%%% \usepackage{fancyhdr} \usepackage{lastpage} \pagestyle{fancy} % plain / empty / headings / myheadings / fancy \pagenumbering{arabic} % arabic / roman / Roman / alph / Alph \fancyhead[LE,LO]{資工二} \fancyhead[CE,CO]{B01902109} \fancyhead[RE,RO]{洪湧} \fancyfoot[LE,LO]{} \fancyfoot[CE,CO]{Page~\thepage ~of~\pageref*{LastPage}} \fancyfoot[RE,RO]{} \renewcommand{\headrulewidth}{0.5pt} \renewcommand{\footrulewidth}{0pt} %%%%%%%%%%%%%%% **# title format & spacing #** %%%%%%%%%%%%% \usepackage[sf]{titlesec} \titleformat{\section }[hang]{\large}{\textbf{Problem\ \thesection}}{0em}{}{} \titleformat{\subsection}[hang]{ }{\thesubsection .}{1em}{}{} \usepackage{chngcntr} \renewcommand{\thesubsection}{\alph{subsection}} %%%%%%%%%%%%%%%%%% **# multi columns #** %%%%%%%%%%%%%%%%%%% \usepackage{multicol} \setlength{\columnsep }{30pt} \setlength{\columnseprule}{0.5pt} %%%%%%%%%%%%%%%%%%% **# table of content #** %%%%%%%%%%%%%%% \usepackage{tocloft} \renewcommand{\cftsecleader }{\cftdotfill{\cftdotsep}} %%%%%%%%%%%%%%%%%%%% **# mathematics #** %%%%%%%%%%%%%%%%%%% \usepackage{amsmath, amsthm, amssymb} \theoremstyle{definition} \newtheorem*{defi}{Definition} \theoremstyle{plain} \newtheorem{thm}{Theorem} \newtheorem{cor}[thm]{Corollary} \newtheorem{lemma}[thm]{Lemma} %%%%%%%%%%%%%%%%%%%%% **# algorithm #** %%%%%%%%%%%%%%%%%%%% \usepackage{algorithmicx} \usepackage{algorithm} \usepackage{algc} \usepackage{algcompatible} \usepackage[noend]{algpseudocode} %%%%%%%%%%%%%%%%%%%%%%% **# etc #** %%%%%%%%%%%%%%%%%%%%%%%% \usepackage{listings} \usepackage{url} \usepackage{hyperref} \hypersetup{ bookmarks = true, unicode = true, colorlinks = true, linkcolor = blue linkcolor = blue, urlcolor = blue, citecolor = blue, anchorcolor = blue } %%%%%%%%%%%%%%%%%% **# custom commands #** %%%%%%%%%%%%%%%%% \newcommand{\Indent}[2]{\parindent=#1 \leftskip=#2} \newcommand{\Usesize}[2]{\fontsize{#1}{#2}\selectfont \fontsize{#1}{#2}\selectfont} \newcommand{\lstsetCPP}[0]{\lstset{ basicstyle=\small, % font size breakatwhitespace=false, % automatic breaks only happen at whitespace breaklines=true, % automatic line breaking captionpos=b, % caption-position to bottom escapeinside={\%*}{*)}, % if you want to add LaTeX within your code extendedchars=true, % lets you use non-ASCII characters; for 8-bits encodings only, does not work with UTF-8 frame=single, % adds a frame around the code keepspaces=true, % keeps spaces in text, useful for keeping indentation of code (possibly needs columns=flexible) language=C++, % the language of the code numbers=left, % where to put the line-numbers; (none, left, right) numbersep=4pt, % how far the line-numbers are from the code showspaces=false, % show spaces everywhere adding particular underscores; it overrides 'showstringspaces' showstringspaces=false, % underline spaces within strings only showtabs=false, % show tabs within strings adding particular underscores stepnumber=1, % the step between two line-numbers. tabsize=4, % tabsize }} \newcommand{\LineIf}[2]{\State \algorithmicif\ {#1}\ \algorithmicthen\ {#2}} %%%%%%%%%%%%%%%%%%%%%%%%% **# 本文 #** %%%%%%%%%%%%%%%%%%% \begin{document} \Indent{0em}{3em} hi! \Kai 啦啦\textbf{啦} \Indent{0em}{5em} 啦啦\textbf{啦}aaaaaaaaaaaaa b c xxx xxxxxxxxxxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxxxxxxxxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxxxxxxxxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxxxxxxxxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxxxxxxxxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx \\ \Indent{0em}{7em} \begin{itemize} \Indent{0em}{7em} \itemsep = 0em \item b xxxxxxxxxxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxxxxxxxxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxxxxxxxxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxxxxxxxxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx \end{itemize} \Hei 啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦 啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦 啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦 啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦 啦啦啦啦啦啦啦啦啦啦啦啦啦啦 啦啦\textbf{啦}aaaaaaaaaaaaa b c xxx xxxxxxxxxxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxxxxxxxxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxxxxxxxxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxxxxxxxxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx x \end{document} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \newtheorem{thm}{Theorm} 定理 % \newtheorem{thm}{Theorm}[section] 加入節...? % \newtheorem{lem}[thm]{Lemma} 和定理一起編號 % \newtheorem*{mainthm}{Main Theorem} 不要編號 % \begin{thm}\label{T:major} ... \ref{T:major} 用label, 引用 % \begin{array}{clr} ... & ... \\ 矩陣用 % \begin{align} %titleformat{command}[shape]{format}{label}{sep}{before}[after] % command: 要定義的標題 % shape : 形狀 hang|block|display % format : 標題外觀(至中對齊啦, 粗體啦...) % label : 標籤(標號) % sep : 標題標籤與內容之間的間隔 % befor : 內容之前 % after : 內容之後 %titlespacing{command}{left}{before}{after} % command: 要定義的標題 % left : 標題左邊偏移 % before : 與前一段文字間隔 % after : 與後一段文字間隔 % \setcounter{secnumdepth}{3} 自己定義要標號到多深 % -1 part, 0~5 ch, se, subse, subsubse, par, subpar %%%%%%%%%%%%%%%%%%%% 筆記區 %%%%%%%%%%%%%%%%%%%%%% % ~ & 空白 表格中的分隔 % \, \: \; \quad \qquad \hspace{2cm} 小中大空白 % \smallskip \medskip \bigskip \vspace{2cm} 垂直移動3, 6, 12, 自訂 % \hfill, \vfill 平均的塞入 水平/垂直 空間 % \dotfill \hrulefill 塞 點/線 進去 % \tiny \small \large \Large \LARGE \huge \Huge 字體大小 % \emph{} \bf{} 斜體, 粗體 % \title{} \author{} \date{} \maketitle 封面用 % $...$ \[...\] 數學 隨文/展示 模式 % \textbackslash $\backslash% 反除號 % \part \chapter \section \paragraph section command % \begin{itemize/enumerate/description} \item item %Options: Sonny, Lenny, Glenn, Conny, Rejne, Bjarne, Bjornstrup %\usepackage[Sonny]{fncychap} 漂亮的chapter % \begin{raggedleft / flushright / center} %靠左/右/中對齊(前者不切齊) % \linespread{0.5} % \begin{minipage}[t]{0.40\linewidth} % \end{minipage} % \begin{tabular}[t / b / c]{r|cc||l} % bla & x & y & bla (\\ or \tabularnewline) % \hline % bla & x & y & bla (\\ or \tabularnewline) % \end{tabular} % \begin{multicols}{2} % \end{multicols} % \begin{itemize} % \itemsep = 0em % \item ... % \end{itemize} % \tableofcontents %目錄 %\begin{algorithm} %\begin{algorithmic}[1] % \caption{My algorithm}\label{euclid} % \Function{$BinSearch$}{$record array arr, integer len, integer value$} % \State{$left \gets 0, {right} \gets \mathrm{len}$} % \State ${ans} \gets -1$ % \While{ $left < right$ } % \State $mid \gets ??$ % \If{$arr[mid] = value$} % \State $ans \gets mid, left \gets mid+1$ % \ElsIf{$arr[mid] > value$} % \State{$right \gets mid$} % \ElsIf{$arr[mid] < value$} % \State{$left \gets mid+1$} % \EndIf % \EndWhile % \LineIf{$ans = -1$}{\Return $NOTFOUND$} % \State \Return $arr[ans]$ % \EndFunction %\end{algorithmic} %\end{algorithm}