%----------------------------------------------------------------------------------------
% This is the template of notes or problem sets.
% Credit: Anthony Sung
% Contact: xiaolong70701@gmail.com
%----------------------------------------------------------------------------------------
\documentclass[12pt, a4papaer, AutoFakeBold, AutoFakeSlant]{article}
%%% GEOMETRY SETTING %%%
\usepackage{fancyhdr} % Required for custom headers
\usepackage{geometry} % Setting the geometry of the document
\geometry{headheight = 2.54cm, bottom = 2.54cm, right = 3.18cm, left = 3.18cm}
\usepackage{appendix}
%%% FIGURE SETTING %%%
\usepackage{graphicx} % Required to insert images
\usepackage{float}
\usepackage{subfigure}
\graphicspath{{./figures/}}
%%% TABLE SETTING %%%
\usepackage{booktabs} % include more gallery for tables
\usepackage{longtable} % If you need longtable
\usepackage{dcolumn} % For single row in stargazer regression table
\usepackage{multirow} % Multirow or multicolumn cell in table
%%% TIKZ SETTING %%%
\usepackage{tikz}
\tikzset{>=latex} % for LaTeX arrow head
\usepackage{pgfplots} % for the axis environment
\usepackage{xcolor}
\usepackage[outline]{contour} % halo around text
\contourlength{1.2pt}
\usetikzlibrary{positioning,calc}
\usetikzlibrary{backgrounds}% required for 'inner frame sep'
%\usepackage{adjustbox} % add whitespace (trim)
% define gaussian pdf and cdf
\pgfmathdeclarefunction{gauss}{3}{%
\pgfmathparse{1/(#3*sqrt(2*pi))*exp(-((#1-#2)^2)/(2*#3^2))}%
}
\pgfmathdeclarefunction{cdf}{3}{%
\pgfmathparse{1/(1+exp(-0.07056*((#1-#2)/#3)^3 - 1.5976*(#1-#2)/#3))}%
}
\pgfmathdeclarefunction{fq}{3}{%
\pgfmathparse{1/(sqrt(2*pi*#1))*exp(-(sqrt(#1)-#2/#3)^2/2)}%
}
\pgfmathdeclarefunction{fq0}{1}{%
\pgfmathparse{1/(sqrt(2*pi*#1))*exp(-#1/2))}%
}
\colorlet{mydarkblue}{blue!30!black}
% to fill an area under function
\usepgfplotslibrary{fillbetween}
\usetikzlibrary{patterns}
\pgfplotsset{compat=1.12} % TikZ coordinates <-> axes coordinates
% https://tex.stackexchange.com/questions/240642/add-vertical-line-of-equation-x-2-and-shade-a-region-in-graph-by-pgfplots
% plot aspect ratio
%\def\axisdefaultwidth{8cm}
%\def\axisdefaultheight{6cm}
% number of sample points
\def\N{50}
\usepackage{mathtools}
\usepackage{tkz-euclide}
% arrow and line for 'tkzPointShowCoord'
\makeatletter
\tikzset{arrow coord style/.style={%
densely dashed,
\tkz@euc@linecolor,
%>=stealth',
%->,
}}
\tikzset{xcoord style/.style={%
\tkz@euc@labelcolor,
font=\normalsize,text height=1ex,
inner sep = 0pt,
outer sep = 0pt,
fill=\tkz@fillcolor,
below=6pt
}}
\tikzset{ycoord style/.style={%
\tkz@euc@labelcolor,
font=\normalsize,text height=1ex,
inner sep = 0pt,
outer sep = 0pt,
fill=\tkz@fillcolor,
left=6pt
}}
\makeatother
%%% EMBED CODE SETTING %%%
\usepackage{listings, lstautogobble} % For insert cod in the document
\lstset{
backgroundcolor = \color{lightgray},
basicstyle = {\small\ttfamily},
breaklines = true,
postbreak = \raisebox{0ex}[0ex][0ex]{\ensuremath{\color{lightgray}\hookrightarrow\space}},
stringstyle=\color{darkcyan},
otherkeywords={0,1,2,3,4,5,6,7,8,9},
morekeywords={TRUE,FALSE},
deletekeywords={data,frame,length,as,character},
keywordstyle=\color{blue},
commentstyle=\color{darkcyan},
}
%%% MATH SETTING %%%
\usepackage{amsmath, mathtools, amssymb, empheq, amsthm, cancel, mleftright} %
\DeclareMathOperator{\erf}{erf}
\DeclareMathOperator{\arcsec}{arcsec}
\DeclareMathOperator{\arccot}{arccot}
\DeclareMathOperator{\arccsc}{arccsc}
\DeclareMathOperator{\supp}{supp}
\DeclareMathOperator{\diag}{diag}
\DeclareMathOperator*{\argmax}{arg\,max}
\DeclareMathOperator*{\argmin}{arg\,min}
\renewcommand\qedsymbol{$\blacksquare$}
\allowdisplaybreaks
% [HINT] You can use \newcommand{cmd}[args][default]{def} to create your own command
%%% COLORBOX SETTING %%%
\usepackage{tcolorbox}
\newtcolorbox{whitebox}{colframe = white}
%%% REFFERENCE SETTING %%%
\usepackage{hyperref} % Set some hyperref style
\hypersetup{
colorlinks = true,
linkcolor = blue,
filecolor = magenta,
urlcolor = sinopia,
}
\urlstyle{same}
%%% TITLE SETTING %%%
\usepackage{titlesec} % Custom section title style
\titleformat{\section}{\normalfont\Large}{\thesection}{1em}{}
\titleformat{\subsection}{\normalfont\large}{\thesubsection}{1em}{}
\titleformat{\subsubsection}{\normalsize\yuan}{\arabic{section}.\arabic{subsection}.\arabic{subsubsection}\quad}{0em}{}
%%% FONT SETTING %%%
\PassOptionsToPackage{no-math}{fontspec}
\usepackage{xeCJK}
\setmainfont[Path=./fonts/,
Numbers = OldStyle,
ItalicFont={Times New Roman Italic.ttf},
BoldFont={Times New Roman Bold.ttf},
BoldItalicFont={Times New Roman Bold Italic.ttf}]{LinLibertine_R.otf} % Set the main font of the document
\setCJKmainfont[Path=./fonts/]{cwTeXQMing-Medium.ttf} % set the main Chinese font in the document
\setCJKfamilyfont{kai}[Path=./fonts/]{cwTeXQKai-Medium.ttf}
\newcommand{\kai}[1]{{\CJKfamily{kai}#1}}
\setCJKfamilyfont{yuan}[Path=./fonts/]{cwTeXQYuan-Medium.ttf} % yuan
\newcommand{\yuan}[1]{{\CJKfamily{yuan}#1}}
\setCJKfamilyfont{hei}[Path=./fonts/]{cwTeXQHei-Bold.ttf}
\newcommand{\hei}[1]{{\CJKfamily{hei}#1}}
%\newfontfamily\cb{Arial} % add some font family
\usepackage{mathspec} % Includes amsmath.
\setmathsfont(Digits)[Numbers=OldStyle]{LinLibertine_R.otf}
%%% COLOR SETTING %%%
\usepackage{xcolor}
\definecolor{lightgray}{RGB}{242, 242, 242}
\definecolor{shadecolor}{rgb}{0.94, 0.97, 1.0}
\definecolor{sinopia}{rgb}{0.8, 0.25, 0.04}
\definecolor{brightmaroon}{rgb}{0.76, 0.13, 0.28}
\definecolor{deepcarmine}{rgb}{0.66, 0.13, 0.24}
\definecolor{shadecolor}{rgb}{0.94, 0.97, 1.0}
\definecolor{sinopia}{rgb}{0.8, 0.25, 0.04}
\definecolor{brightmaroon}{rgb}{0.76, 0.13, 0.28}
\definecolor{deepcarmine}{rgb}{0.66, 0.13, 0.24}
\definecolor{darkcyan}{rgb}{0.0, 0.55, 0.55}
%%% MISCELLANEOUS SETTING%%%
\usepackage{gensymb}
\usepackage{parskip} % No indents for each paragraphs
\parindent = 0pt
\usepackage{setspace} % Set linespace to one and a half
\onehalfspacing
\usepackage{enumitem} % custom bullets
\usepackage{ragged2e}
%----------------------------------------------------------------------------------------
% HEADER AND FOOTER
%---------------------------------------------------------------------------------------
\pagestyle{fancy}
\fancyhf{}
\lhead{\normalsize 筆記模板 \\ 章節名稱}
\rhead{\normalsize 課程名稱 \\ 姓名}
\cfoot{\footnotesize \thepage}
\begin{document}
\justifying
數字:1234567890\\
英文:abcdefghijklmnopqrstuvwxyz\\
中文:這是中文\\
斜體:\textit{italic}、\textit{斜體}\\
粗體:\textbf{bold}、\textbf{粗體}\\
粗斜體:\textbf{\textit{bold italic}}、\textbf{\textit{粗斜體}}
\[
\frac{d}{dx} = \frac{1}{23414}
\]
如果想要使用文字方框,可以使用 \verb*|whitebox| 環境:
\begin{whitebox}
文字
\end{whitebox}
插入圖片的方式如下:
\begin{figure}[H]
\centering
\includegraphics[width=.7\textwidth]{latex.png}
\end{figure}
\end{document}