Latex使用筆記(TexStudio,樹狀圖、八數碼模板、中文小論文模板)

本篇文章參考了加入兩行代碼使TexStudio支持中文

調整TexStudio的畫面字體爲中文

以及關於Overleaf的博文

本篇文章有意冒犯侵犯,如侵,聯繫我,速刪

1、 調整界面、TexStudio支持中文的兩行代碼

\usepackage{fontspec}
\setmainfont[Mapping=tex-text]{KaiTi}

在這裏插入圖片描述

在這裏插入圖片描述
設置默認編輯器XeLaTex,因爲處理中文比較方便。在這裏插入圖片描述
在這裏插入圖片描述
新建TeX
點擊文件->新建(或者選第二個從模板新建),名字應該不支持中文,我寫的中文名字編譯錯誤,改爲應爲後不再報錯

\documentclass[12pt,a4paper]{article}

\usepackage{fontspec}
\setmainfont[Mapping=tex-text]{KaiTi}

%opening
\title{第七章作業}
\author{劉小}

\begin{document}

\maketitle

\begin{abstract}

\end{abstract}

\section{}
你好,劉小
\end{document}

在這裏插入圖片描述

2 符號使用

在這裏插入圖片描述
在這裏插入圖片描述

中文小論文的模板

\documentclass[UTF8,a4paper,10pt]{ctexart}
\usepackage[left=2.50cm, right=2.50cm, top=2.50cm, bottom=2.50cm]{geometry} %頁邊距
\CTEXsetup[format={\Large\bfseries}]{section} %設置章標題居左


%%%%%%%%%%%%%%%%%%%%%%%
% -- text font --
% compile using Xelatex
%%%%%%%%%%%%%%%%%%%%%%%
% -- 中文字體 --
%\setmainfont{Microsoft YaHei}  % 微軟雅黑
%\setmainfont{YouYuan}  % 幼圓    
%\setmainfont{NSimSun}  % 新宋體
%\setmainfont{KaiTi}    % 楷體
%\setmainfont{SimSun}   % 宋體
%\setmainfont{SimHei}   % 黑體
% -- 英文字體 --
%\usepackage{times}
%\usepackage{mathpazo}
%\usepackage{fourier}
%\usepackage{charter}
\usepackage{helvet}


\usepackage{amsmath, amsfonts, amssymb} % math equations, symbols
\usepackage[english]{babel}
\usepackage{color}      % color content
\usepackage{graphicx}   % import figures
\usepackage{url}        % hyperlinks
\usepackage{bm}         % bold type for equations
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{epstopdf}
\usepackage{epsfig}
\usepackage{algorithm}
\usepackage{algorithmic}
\renewcommand{\algorithmicrequire}{ \textbf{Input:}}     % use Input in the format of Algorithm  
\renewcommand{\algorithmicensure}{ \textbf{Initialize:}} % use Initialize in the format of Algorithm  
\renewcommand{\algorithmicreturn}{ \textbf{Output:}}     % use Output in the format of Algorithm  


\usepackage{fancyhdr} %設置頁眉、頁腳
%\pagestyle{fancy}
\lhead{}
\chead{}
%\rhead{\includegraphics[width=1.2cm]{fig/ZJU_BLUE.eps}}
\lfoot{}
\cfoot{}
\rfoot{}


%%%%%%%%%%%%%%%%%%%%%%%
%  設置水印
%%%%%%%%%%%%%%%%%%%%%%%
%\usepackage{draftwatermark}         % 所有頁加水印
%\usepackage[firstpage]{draftwatermark} % 只有第一頁加水印
% \SetWatermarkText{Water-Mark}           % 設置水印內容
% \SetWatermarkText{\includegraphics{fig/ZJDX-WaterMark.eps}}         % 設置水印logo
% \SetWatermarkLightness{0.9}             % 設置水印透明度 0-1
% \SetWatermarkScale{1}                   % 設置水印大小 0-1    

\usepackage{hyperref} %bookmarks
\hypersetup{colorlinks, bookmarks, unicode} %unicode

\title{\textbf{論文題目}}
\author{ 學號:***  姓名:小紅}
\bibliographystyle{IEEEtran}
\begin{document}
	\maketitle
	
	\renewcommand{\abstractname} {摘要}
	\begin{abstract}
		摘要。
		
		關鍵詞:代碼表示、深度學習、程序理解
	
	\end{abstract}
	
	\section{第一標題}
	一級標題內容
	
	\subsection{第二標題}
	二級標題內容
	
	\subsubsection{三級標題}
	三級標題內容。
	\subsubsection{三級標題}
	三級標題內容。
	
	
	\subsection{二級標題}
	二級標題內容
	\subsubsection{三級標題}
	三級標題內容
%插入圖片
%  bubblesort.png是同一目錄下的圖片名稱  	\includegraphics[width=0.6\textwidth]{bubblesort.png}%\vspace{-35pt}
%加入對圖片的說明\caption{冒泡排序的算法}%*{(a)Time}
		\begin{figure}[H]\vspace{-5pt}
		\centering
		\includegraphics[width=0.6\textwidth]{bubblesort.png}%\vspace{-35pt}
		\caption{冒泡排序的算法}%*{(a)Time}
		\label{fig:LE}
	    \end{figure}
    
    
   %插入表格
   %三線表樣式
  
  	\begin{center}  %使表格居中
  	\begin{tabular}{c c c}%{|c|c|c|}% 通過添加 | 來表示是否需要繪製豎線
  		\hline  % 在表格最上方繪製橫線
  		1&2&3\\
  		\hline  %在第一行和第二行之間繪製橫線
  		8&4&5\\
  		%\hline % 在第二行和第三行之間繪製橫線
  		7&\quad&6\\
  		\hline % 在表格最下方繪製橫線
  	\end{tabular}
  	\end{center}
  	
	\subsubsection{三級標題}
	三級標題內容
	
	

	\section{第二個一級標題}
	
	\subsection{二級標題}
	
	
	\subsubsection{三級標題}

	
	\subsubsection{三級標題}
	
	\section{問題與挑戰} 
	問題與挑戰
	\section{結論}
	此處寫結論
\bibliography{reference.bib}
\end{document}

% argument is your BibTeX string definitions and bibliography database(s)


%\bibliographystyle{unsrt}  %    
%\bibliography{reference}

細節部分:

雙標題:

\title{
A Novel Neural Source Code Representation ased
on Abstract Syntax Tree
\newline 一種新穎的基於抽象語法樹的神經源代碼表示方法
}

三線表居中

\begin{center}  %使表格居中
  	\begin{tabular}{c c c}%{|c|c|c|}% 通過添加 | 來表示是否需要繪製豎線
  		\hline  % 在表格最上方繪製橫線
  		1&2&3\\
  		\hline  %在第一行和第二行之間繪製橫線
  		8&4&5\\
  		%\hline % 在第二行和第三行之間繪製橫線
  		7&\quad&6\\
  		\hline % 在表格最下方繪製橫線
  	\end{tabular}
  	\end{center}
![在這裏插入圖片描述](https://img-blog.csdnimg.cn/20200424135930215.png)

圖形模板:

樹狀圖:

①單個結點樣式:

在這裏插入圖片描述

②多結點樹狀圖:
\begin{tikzpicture}[
every node/.style={
	circle, draw,
	inner sep=0pt,
	text width=6mm,
	align=center
},
level distance=10mm,
level 1/.style={sibling distance=30mm},
level 2/.style={sibling distance=15mm}
]
\node{$1$}
child { node{$2$}  
	}
child[missing];
\end{tikzpicture}

在這裏插入圖片描述

\begin{tikzpicture}[
every node/.style={
	circle, draw,
	inner sep=0pt,
	text width=6mm,
	align=center
},
level distance=10mm,
level 1/.style={sibling distance=30mm},
level 2/.style={sibling distance=15mm}
]
\node{$1$}
child { node{$2$}  
	child{
		node{$6$}
		child{
			node{$5$}
		}
	child[missing]
	}
child[missing]
}
child[missing];
\end{tikzpicture}

在這裏插入圖片描述

\begin{tikzpicture}[
	every node/.style={
		circle, draw,
		inner sep=0pt,
		text width=6mm,
		align=center
	},
	level distance=10mm,
	level 1/.style={sibling distance=30mm},
	level 2/.style={sibling distance=15mm}
	]
	\node{$15$}
	child { node{$5$}  
		child[missing]
		child { node{$7$} }
	}
	child { node{$20$}  
		child { node{$18$}
			child { node{$16$} }
			child[missing]
		}
		child { node{$25$} }
	};
	\end{tikzpicture}

在這裏插入圖片描述

八數碼問題
\begin{tikzpicture}
[thick,scale=2, every node/.style={scale=1}]
\node{
	\begin{tabular}{|c|c|c|}% 通過添加 | 來表示是否需要繪製豎線
	\hline  % 在表格最上方繪製橫線
	1&2&3\\
	\hline  %在第一行和第二行之間繪製橫線
	8&4&5\\
	\hline % 在表格最下方繪製橫線
	7&\quad&6\\
	\hline % 在表格最下方繪製橫線
	\end{tabular}
}
child{
	node{
		\begin{tabular}{|c|c|c|}% 通過添加 | 來表示是否需要繪製豎線
		\hline  % 在表格最上方繪製橫線
		1&2&3 \\
		\hline  %在第一行和第二行之間繪製橫線
		8&4&5\\
		\hline % 在表格最下方繪製橫線
		\quad&7&6\\
		\hline % 在表格最下方繪製橫線
		\end{tabular}
	}
}
child{
	node{
		\begin{tabular}{|c|c|c|}% 通過添加 | 來表示是否需要繪製豎線
		\hline  % 在表格最上方繪製橫線
		1&2&3 \\
		\hline  %在第一行和第二行之間繪製橫線
		8&4&5\\
		\hline % 在表格最下方繪製橫線
		7&6&\quad\\
		\hline % 在表格最下方繪製橫線
		\end{tabular}
	}
}
;
\end{tikzpicture}

在這裏插入圖片描述

\begin{tikzpicture}
[thick,scale=2, every node/.style={scale=1}]
\node{
	\begin{tabular}{|c|c|c|}% 通過添加 | 來表示是否需要繪製豎線
	\hline  % 在表格最上方繪製橫線
	1&2&3 \\
	\hline  %在第一行和第二行之間繪製橫線
	8&4&5\\
	\hline % 在表格最下方繪製橫線
	7&6&\quad\\
	\hline % 在表格最下方繪製橫線
	\end{tabular}
}
child{
	node{
		\begin{tabular}{|c|c|c|}% 通過添加 | 來表示是否需要繪製豎線
		\hline  % 在表格最上方繪製橫線
		1&2&3 \\
		\hline  %在第一行和第二行之間繪製橫線
		8&4&\quad\\
		\hline % 在表格最下方繪製橫線
		7&6&5\\
		\hline % 在表格最下方繪製橫線
		\end{tabular}
	}
}
;
\end{tikzpicture}\newline

在這裏插入圖片描述

上下標問題

通常使用:w1{w_1}或者w1{w^1}
在多餘一個字符時,使用=={}==,如:

\begin{center}
		$ p=f(W^{(1)}[c_1:c_2]+b^{(1)} )$
	\end{center}

在這裏插入圖片描述
特殊字符“單引號”

\begin{center}
		$ [c_1^{'},c_2^{'}]=W^{(2)}p+b^{(2)} $
	\end{center}

在這裏插入圖片描述

字母上添加左右箭頭

\begin{center}
	$	\overrightarrow{h_t}=\overrightarrow{GRU(e_t)},t \in [1,T]$
		
		\overleftarrow{h_t}=\overleftarrow{GRU(e_t)},t \in [T,1]
	\end{center}

在這裏插入圖片描述

大括號內多行公式

	\begin{center}
		\begin{equation}
		prediction=\left \{\begin{aligned}
			True,p>\delta,\\
			False,p \leq \delta
			\end{aligned}}
		\right
		\end{equation}
	\end{center}

在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章