[Graduate Writing] LaTex related usage

This article was edited during the writing period. XDUers who use the XDUTS template can refer to the questions in it. At the same time, I would like to thank the template author for his efforts!

XDUTS template

Github address: https://github.com/note286/xduts
VSCode LaTex environment configuration: https://zhuanlan.zhihu.com/p/166523064 Create a new file main.tex
in the directory and add the simplest sample compilation in the manual That’s it.

Quote

Very disgusting question. Generally speaking, \cite + the correct bib file can
be used when compiling: image.png
three errors will be reported at the beginning: bibtex I found no \citation commandswait and
search: add macro package: \usepackage[backend=bibtex]{biblatex}
or change the compiler to Biber
This article saved the dog Fate: https://blog.csdn.net/ya6543/article/details/112542915

algorithm

  1. Import macro package
\usepackage{algorithm} 
\usepackage{algorithmic} 
\renewcommand{\algorithmicrequire}{ \textbf{Input:}}     %Use Input in the format of Algorithm
\renewcommand{\algorithmicensure}{ \textbf{Output:}}    %UseOutput in the format of Algorithm
% 推荐使用中文提示
% \renewcommand{\algorithmicrequire}{ \textbf{输入:}}     
% \renewcommand{\algorithmicensure}{ \textbf{输出:}}    

Or the algorithmim2e package

  1. example:
\begin{algorithm}
\caption{计算从1到n的和}              %标题
\label{alg1}                        %标记算法,方便在其它地方引用
\begin{algorithmic}
\REQUIRE$n \geq 1$                  %输入条件
\ENSURE$Sum = 1 + \cdots + n$      %输出
\STATE$Sum \leftarrow 0$            %\STATE 命名演示
\IF{$n < 1$}                        %条件语句
\PRINT{InputErrow}                %打印语句
\ELSE
    \FOR{$i = 0$ to n}          %FOR循环结构
    \STATE$Sum = Sum + i$\\
    \STATE$i = i + 1$
    \ENDFOR
\ENDIF
\RETURN $Sum$
\end{algorithmic}
\end{algorithm}
  1. Algorithm references

image.png

definition

  1. Import macro package
\usepackage{amsthm}

Note: If you have already imported the macro package amsmath, skip this step because amsmath contains amsthm

  1. The definition
    is defined in the preamble (after usepackage):
\newtheorem{myDef}{Definition}
  1. use
\begin{myDef}
	\label{label}
    ...
\end{myDef}

illustration

Reference: https://blog.csdn.net/qq_30759585/article/details/123331264Successful
examples:

\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage[rightcaption]{sidecap}

\begin{figure}[h]
    \includegraphics{vp1.png}
    \centering
    \caption{vp1}
\end{figure}

Illustrations are too large (overfull)

Add parameter [width=0.95\textwidth]
width=0.95 refers to the proportion of the width of the image in the current page, and the height is automatically scaled proportionally.

\begin{figure}[h]
    \includegraphics[width=0.95\textwidth]{key-example.png}
    \centering
    \caption{关系型数据转为KV数据}
    \label{key-example}
\end{figure}

Sub-pictures (three sub-pictures)

The three pictures are too small when placed horizontally and too large vertically. They can be placed in a triangle.

% 在 figure 环境中使用 subfigure 命令创建子图
\begin{figure}[htb]
	\centering
	\subfigure[标题1]{ % 设置子图的标题
		\includegraphics[width=0.48\linewidth]{pre0-0.png}
		\label{pre1}}
	% \hfill
	\subfigure[标题2]{ % 设置子图的标题
		\includegraphics[width=0.48\linewidth]{pre0-1.png}
		\label{pre2}}
	\vspace{0.5cm}
	\subfigure[标题3]{ % 设置子图的标题
		\includegraphics[width=0.48\linewidth]{pre0-2.png}
		\label{pre3}}
	\caption{图名}
	\label{fig:subfigs2}
\end{figure}

The two pictures are relatively simple:

\begin{figure}
	\centering  %图片全局居中
	% \subfigbottomskip=2pt %两行子图之间的行间距
	% \subfigcapskip=-5pt %设置子图与子标题之间的距离
	\subfigure[子图1]{
		\includegraphics[width=0.48\linewidth]{1-1-v1.png}}
	\subfigure[子图2]{
		\includegraphics[width=0.48\linewidth]{1-2.png}}
	\caption{图名}
\end{figure}

divided into files

\input{chapter1}
\input{chapter2}
\input{chapter3}
\input{chapter4}

Note: No need to add the suffix .tex

sheet

Online table generation: https://www.tablesgenerator.com/latex_tables
has no title by default:

\begin{
    
    table}[]
\begin{
    
    tabular}{
    
    lll}
\hline
1 & 1 & 1 \\ \hline
1 & 1 & 1 \\
1 & 1 & 1 \\ \hline
\end{
    
    tabular}
\end{
    
    table}

You can choose to have a title:
image.png
Correction: Please choose caption above!

\begin{
    
    table}[]
\begin{
    
    tabular}{
    
    lll}
\hline
1 & 1 & 1 \\ \hline
1 & 1 & 1 \\
1 & 1 & 1 \\ \hline
\end{
    
    tabular}
\caption{
    
    表格标题}
\label{
    
    tab1}
\end{
    
    table}

Center in article:

\begin{
    
    table}[H]
	\centering
    \begin{
    
    tabular}{
    
    lll}
    \hline
    1 & 1 & 1 \\ \hline
    1 & 1 & 1 \\
    1 & 1 & 1 \\ \hline
    \end{
    
    tabular}
    \caption{
    
    表格标题}
    \label{
    
    tab1}
    \end{
    
    table}

Line spacing problem

The line spacing between the XDUTS template title and the text is very strange. You can add it above and below each title to make it more beautiful.

 \hspace*{\fill}  

for example:

\hspace*{\fill}
\section{实验环境和数据设置}
\hspace*{\fill}

postscript

I was selected for the blind review by the school and passed. There are no major problems with the format of the template. Please pay attention to the following issues:

  • There are no special requirements for the above line spacing issue, but it needs to look beautiful.
  • Pay attention to the pixels of the picture. It is recommended to use Python for drawing.
  • Pay attention to the size of the picture. If it is a group of sub-pictures, the size needs to be the same.
  • Pictures, tables and other charts need to be translated into Chinese

Guess you like

Origin blog.csdn.net/qq_39679772/article/details/130293848