论文排版和作图

Latex使用

1. 特殊符号

1.1. 断字符 (hyphenation) 

latex使用了处理断字的算法去自动的找断字的地方,而且latex会调整单词间距,使得文章看起来不会显得疏密不一致。大多数情况下,这些算法都工作得很好。但是因为断字的算法是根据某种规则来处理单词的断字,而不是依照人工事先标注的字典,所以,它仍然会出问题。或是在不该断的地方断开了,又或者是断开的地方太多了等等。在latex下可以通过调整参数和指定断字点来处理这些问题。

\hyphenpenalty=5000
\tolerance=1000=5000
\tolerance=1000

可以把这两个参数的调整加到tex文件里。hyphenpenalty的意思比较显而易见,这个值越大断字出现的就越少。tolerance越大,换行就会越少,也就是说,latex会把本该断开放到下一行的单词,整个儿的留在当前行。调这两个值就可以得到不一样的排版,有可能可以解决断字太多的问题。

如果遇到了断开的地方不对的情况,也可以手动来指定一个单词应该怎么断。

<span style="color:#cc33cc">\hyphenation{hy-phen-a-tion}</span>

这个命令告诉latex,hyphenation只能从标有短横线(-)的地方断开。

或者:

For the words smallspace, and results to get hyphenated as s-malls-pace, and result-s, somebody or something must have reset two of TeX's fundamental hyphenation-related parameters, viz., \lefthyphenmin and \righthyphenmin. For an English-language setting, the default values of these parameters are

\lefthyphenmin=2

and

\righthyphenmin=3

Something in your document must have managed to set both parameters to 1 (or possibly 0). Be sure to either delete the commands that modify these two parameters or insert the two instructions above in your document (to reset the parameter values to their respective default values).

1.2. 井号 # 符号

文本中直接使用#会报错,可以参考下面的用法:

\documentclass{article}

\begin{document}
Using \verb|\verb|: \verb|#| and using \verb|\texttt|: \texttt{\#} and then regular symbol using \verb|\#|: \#

\end{document}

2. 通过mathtype插入公式

注意:直接从mathtype中粘贴公式时,需要将公式两边的符号 $ $ 去掉

 

\begin{equation} \label{eq1}
{L_{MSE}} = \frac{1}{N}\sum\limits_i^N {\left\| {{P_i} - {G_i}} \right\|_2^2} 
\end{equation}

3. 插入并排图片

begin{figure}
\centering
\subcaptionbox{Subcaption A}{\includegraphics[width=0.20\textwidth]{example-image-a}}%
\hfill
\subcaptionbox{Subcaption B}{\includegraphics[width=0.20\textwidth]{example-image-b}}%
\hfill
\subcaptionbox{Subcaption C}{\includegraphics[width=0.20\textwidth]{example-image-c}}%
\hfill
\subcaptionbox{Subcaption D}{\includegraphics[width=0.20\textwidth]{example-image}}%
\caption{Caption}
\end{figure}

另一个例子,并排图片,每个图片有一个figure名和caption

\begin{figure} 
	\begin{minipage}[t]{0.5\textwidth}
		\centering
		\includegraphics[scale=0.2]{cpn.pdf}
		\caption{adefajfadsf dafafa \label{fig:1}}
	\end{minipage}
	\qquad
	\begin{minipage}[t]{0.5\textwidth}
		\centering
		\includegraphics[scale=0.2]{cpn.pdf}
		\caption{6bbadf fwefwea \label{fig:2}}
	\end{minipage}
\end{figure}

4. 各种引用

4.1.  文献引用reference.bib报错

常见问题1. 文献序号显示问号❓异常,比如不能正确显示 Tom et e.l. [1] 而是显示的是Tom et e.l. [?],这是可以检查如下:

检查mytex.blg文件,查看错误日志,如果发现报错‘缺少***.bst文件’,则是因为所使用的latex包里面没有相对应的可用文件,可以自己添加一个,比如IEEEtran.bst,同时把其他可能需要的文件如IEEEabrv.bib也下载拷贝到当前的排版latex中,删除bbl重新编译。

常见问题2. 需要在正文中至少引用一条文献,就不会报错了。另外,有时我们是在原有的论文模板上进行的,这些不仅需要引用至少一条文献,而且需要删除已经存在的.bbl文件,然后重新编译!!

另外补充一点,如果在编写引用文献的过程中出错了,在修改完重新编译之前,也需要删除bbl文件。

如果更新了\cite{}以及bib文件,发现生成的pdf的reference中还包含应该被删除的条目,正文中被删除的引用序号被跳过,这是也应该删除bbl文件,重新编译。

4.2 文献引用的格式问题

4.2.1 文献引用显示的格式[1,2,3]和[1-3]

如果包含了 \usepackage{cite} 包的话,那么在一个地方引用多个文件如果序号是相连的,则会变成[1-3]的形式,如果把这个包去掉,则生成的格式是[1,2,3]。

4.2.2 文献引用缺少年份

查看bib文件中对应文献的year={}之前的逗号是否遗漏。

4.2.3 同时引用多个文献时,只能显示第一文献,其他文献显示的都是问号 ?

把例如   \cite{Chen2017Cascaded, Papandreou2017Towards, He2017Mask, Fang2017RMPE}中逗号之后的空格去掉,不留空格就能显示正确。

4.2.4 bibtex的格式要求说明

详情见如下链接:

https://wenku.baidu.com/view/0f2096643968011ca300916d.html

其中的说明例如:
@article 条目为期刊或杂志上的一篇文章。
    不可少域author, title, journal, year. 
    可省略域volume, number, pages, month, note. @book条目为有确定出版社的书籍。

    不可少域author或editor, title, publisher, year. 
    可省略域volume或number, series, address, edition, month, note. @booklet条目为印制的有封皮的作品,但没有出版社或赞助机构的名称。
      不可少域title. 
    可省略域author, howpublished, address, month, year, note. @conference与下面的@inproceedings相同。

@inbook 条目为一本书的一部分(章,节或某些页)。

    不可少域author或editor, title, chapter和/或pages, publisher,year.     可省略域volume或number, series, type, address, edition, month, note. @incollection条目为一本书中有自己题目的一部分。

    不可少域author, title, booktitle, publisher, year. 
    可省略域editor, volume或number, series, type, chapter, pages, address, edition, month, note. 
@inproceedings 条目为会议论文集中的一篇文章。
    不可少域author, title, booktitle, year.     可省略域editor, volume或number, series, pages, address, month, organization, publisher, note. 

4.3 隐藏文章中交叉引用和文献引用的超链接标志方框

在文章导入package的地方添加:

\hypersetup{hidelinks}  % 隐藏文章中的链接跳转标志框

或者用下面代码,这些包含超链接的文本周围不会会出现彩色的方框,但是超链接文本会使用不同颜色的字体

\usepackage[colorlinks,           
 linkcolor=red,            
 anchorcolor=blue,           
  citecolor=green            
  ]{hyperref}

“colorlinks”的意思是将超链接以颜色来标识,而并非使用默认的方框来标识。
linkcolor, anchorcolor, citecolor分别表示用来标识link, anchor, cite等各种链接的颜色。
若正式的文档中不想使用彩色的标识,但又希望具有超链接的功能,则将上例中的各种颜色换成“black”即可。

还比如,如果将论文中的citation和ref引用字体变成蓝色,用下面设置即可

\usepackage{hyperref} 
\hypersetup{
colorlinks=true,
linkcolor=blue,
citecolor=blue
}

4.4 交叉引用标签名使用段落,图表的本身名,而不是自动编号的数字

把\ref{}改为\nameref{}即可

4.5 footnote引用报错

报错信息:

name{Hfootnote.1} has been referenced but does not exist, replaced by a fixe

解决办法:一般这种情况是因为 you are not following the rule "load hyperref as the last package" and that something is redefining footnote.

5. Latex目录中添加附录,‘Appendix A.

转载自

You can easily achieve what you want using the appendix package. Here's a sample file that shows you how. The key is the titletoc option when calling the package. It takes whatever value you've defined in \appendixname and the default value is Appendix.

\documentclass{report}
\usepackage[titletoc]{appendix}
\begin{document}
\tableofcontents

\chapter{Lorem ipsum}
\section{Dolor sit amet}
\begin{appendices}
  \chapter{Consectetur adipiscing elit}
  \chapter{Mauris euismod}
\end{appendices}
\end{document}

The output looks like

6. 添加appendix

转载自

The \appendix command changes the way sectional units are numbered. The \appendix command generates no text and does not affect the numbering of parts.

Thus, if you want your appendix to be set off with a section-like label you need something like

  \begin{center}
    {\bf APPENDIX}
  \end{center}

I have found the \appendix command to sometimes cause problems since everything which follows it is treated as part of the appendix, for example, a list of figures, which I generally want to place after an appendix is labeled "Appendix: List of Figures".

One can create a section labeled "APPENDIX" with distinctive numbering by using the \section command with suitably redefined commands for the Counters. The following example generates a single "Appendix" with equations numbered A-1, A-2, ...

  \renewcommand{\theequation}{A-\arabic{equation}}
  % redefine the command that creates the equation no.
  \setcounter{equation}{0}  % reset counter 
  \section*{APPENDIX}  % use *-form to suppress numbering

If one had several appendices, appropriate numbering could be obtained by redefining the \thesection command and resetting the section counter in an analogous manner.


7. Latex中添加没有编号的section标题

使用命令  \section*{Appendix A: ******},其中\senction*将不会添加序号

8. Latex多行公式的编写

可以使用 array,用矩阵的形式排列一个个公式,并且把他们对齐

比如:

\begin{sequation} S_{ j }^{ * }\left( p \right) =\left\{ 
    \begin{array}{lr} 
        G({ x,  y  |  \sigma  }_{ k },  r_{ 0 }), \quad 1 \le j \le K \\ 
        G({x, y  |  \sigma  }_{ p }, d_{ 0 }), \quad K+1 \le j  \le K+P.
    \end{array} 
    \right.
    \label{eq1}
    \end{sequation}

9. latex数学公式中的某些字符变成黑体

使用\usepackage{bm}包,然后在数学公式中用\bm{}包裹需要黑体的字符。

比如:

\begin{sequation}
    Sd_{j}^{t}\left( p \right)=\left\{ 
    \begin{array}{lr}
        S_{j}^{t}\left( \bm{p} \right) -\alpha, \:\: S_{j}^{*}\left( p \right)>thre \\    %  \hfill right align
        1-S_{j}^{t}\left( p \right)-\beta , \:\:\: else, 
    \end{array} 
    \right.
    \label{eq2}\end{sequation}

另外,如果想在文本中加黑,也可以使用 bm,例如:COCO validation set and obtain \textbf{73.6\bm\%}  AP

10. latex画表格

控制表格内的字体大小

表格线的加粗,参见:latex表格线的加粗及合并两行_蒋国宝的IT技术博客-CSDN博客_latex表格线加粗

\begin{table}  \footnotesize
            \caption{Results on the validation subset.}    
            \label{table1}
            \centering
        \begin{tabular}{llllllllll}   % 这里面的竖线是小些字母L

            \toprule   % 用来画表格最上方的横线
            Method           &Input           &Stride             & MS               & AP        \hspace{0.05cm}   \vline   \hspace{0.05cm}   & Method           &Input           &Stride             & MS               & AP   \\   %\vline   \
            Method           &Input           &Stride             & MS               & AP        \hspace{0.05cm}   \vline   \hspace{0.05cm}   & Method           &Input           &Stride             & MS               & AP   \\   %\vline   \
            \bottomrule  % 用来画表格最下方的横线
    \end{tabular}
\end{table}  

控制表格或者图片插入的位置:

[!ht] 应该是这样的:
首先,!表示无视美学规则,按下面的要求放置;
然后h t b p分别代表4中放置方式,优先级依次递减。
h=here 放置在代码中这个图片出现的位置,也就是你想让它出现的位置;
t = top 放在该页顶端;
b = bottom 放在该页底部;
p = page 另起一页单独放。
所以,你也可以自己定优先级,tbhp之类啥的

通过对表格进行整体缩放控制大小

使用\resizebox命令

\begin{table*}[!ht] 
	\caption{Results on the MS-COCO 2017 validation set.}\smallskip
	\label{table1}
	\centering
	\resizebox{1.96\columnwidth}{!}{
	\smallskip\begin{tabular}{c|c|c|c|c|c|c|c|c|c|c|c}   % 这里面的竖线是小些字母L   {c|p{3.7cm}|c|c|c|c|c|p{3.2cm}|c|c|c|c} 
		\toprule   % %  还可以用\toprule[2pt] 手动改变表格边界线条的粗细
		ID  & \textbf{Method}      	 &Input           &Stride     &${\cal FL}$                   & \textbf{AP}         &ID      &\textbf{ Method}      	 &Input           &Stride      &${\cal FL}$                       & \textbf{AP}   \\   % line 0
		
		\midrule    
		1 &CMU-Pose (6-stage CMU-Net)   	 &368           &8        &N          &56.0       &12 & 3-stage IMHN,  w/ MST           	                       &384          &4       &Y              &65.1      \\   % line 1
		2&AE (4-stage Hourglass, + val data)         	 &512           &4           &N          & 59.7              &13& 4-stage IMHN        	 &384           &4        &N              & 64.5    \\   %  line 2
		3&Top-down$^{*}$  (8-stage Hourglass)    &256      &4      &N             & 66.9              &14&  4-stage IMHN      	 &384           &4         &Y                  & 67.3   \\   %  line 3
		4 &Ours (3-stage CMU-Net)                                  	 &368           &8          &N      & 56.5         &15&  4-stage IMHN, + val data   	 &384          &4        &Y                & 72.3   \\   %  line 5 
		5 &Ours (3-stage CMU-Net)                                           	 &368           &8             &Y      & 60.7         &16& 4-stage IMHN  plus    	 &512         &4       &Y                  & 69.1   \\   %  line 5 
		6 &Ours (4-stage Hourglass)                 &512         &4          &N           &60.0      &17 &  4-stage IMHN  plus, + val data    	 &512           &4        &Y                & 74.1  \\   %  line 4
		7 &3-stage IMHN                                	 &384          &4          &N               &61.5        &18& 4-stage IMHN, one scale       	 &768           &4        &Y                & 63.4   \\   %  line 6
		8 &3-stage IMHN                              	                   &384          &4        &Y             &65.8        &19&  4-stage IMHN plus,  one scale     	 &768          &4      &Y               &65.9   \\   %  line 7
		9 &3-stage IMHN,   w/o  spatial attention                &384          &4        &Y               &64.6        &20 & PifPaf (ResNet-101),   one scale  	 &801         &8      &--                  & 65.7      \\   %  line 7
		10 &3-stage IMHN,   w/o channel attention                     	                   &384          &4        &Y             &65.4      &21&  PersonLab$^{*}$,  one scale &801          &8        &--           &61.2  \\ %  
		11 &3-stage IMHN, ${\cal FL}$  only for keypoint  	 &384         &4      &Y                  &64.2     &22 &  PersonLab$^{*}$,  one scale &1401         &8       &--         &66.5    \\  %8  
		
		\bottomrule  % 可以在未尾行(\bottomrule[2pt])加粗
			
	\end{tabular}}
\end{table*}  

11. 一行插入两个表

\begin{minipage}{\textwidth}
	\begin{minipage}[t]{0.48\textwidth}
		\centering
		\makeatletter\def\@captype{table}\makeatother\caption{table 1 the first}
		\scalebox{0.85}{  % 控制表格缩放
		\begin{tabular}{cccc} 
			\toprule   % 用来画表格最上方的横线
		\multicolumn{2}{c}{Part}                   \\
		\cmidrule(r){1-2}
		Name     & Description     & Size ($\mu$m) \\
		\midrule
		Dendrite & Input terminal  & $\sim$100     \\
		Axon     & Output terminal & $\sim$10      \\
		Soma     & Cell body       & up to $10^6$  \\
		\bottomrule  % 用来画表格最下方的横线
		\end{tabular}
		}
	\end{minipage}  %   两个表格之间不能添加空行,否则就会变成垂直方向的排列
    % \hspace{2cm}  % 自己想出来的,控制两个并列的表格间距 
	\begin{minipage}[t]{0.48\textwidth}
		\centering
		\makeatletter\def\@captype{table}\makeatother\caption{table 2 then}
		\scalebox{0.85}{
		\begin{tabular}{cccc}        
			\toprule   % 用来画表格最上方的横线
		\multicolumn{2}{c}{Part}                   \\
		\cmidrule(r){1-2}
		Name     & Description     & Size ($\mu$m) \\
		\midrule
		Dendrite & Input terminal  & $\sim$100     \\
		Axon     & Output terminal & $\sim$10      \\
		Soma     & Cell body       & up to $10^6$  \\
		\bottomrule  % 用来画表格最下方的横线
		\end{tabular}}
	\end{minipage}
\end{minipage}

12. 学会使用查看log文件,里面一般会有详细的报错信息!

13. 添加 pdf information

在\title{}命令之前添加以下信息

 \pdfinfo{
/Title (Simple Pose: Rethinking and Improving  a Bottom-up  Approach for Multi-Person Pose Estimation)
/Author (Jia Li, Wen Su, Zengfu Wang)
}

14. vscode latex workshop编译中文论文绑定run button为xelatex -> bibtex -> xelatex*2

通过setting设置: "latex-workshop.latex.recipe.default": "lastUsed", // 定义使用最后一个recipe

并且一定要保证编译的tex文档开头没有使用% !TeX program = xelatex魔法命令

画图

1. ppt画出竖直线和水平线

按住shift键即可。

2. ppt作图利用visio转pdf插入latex,如何去除图的多余边距

在自定义功能区的主选项卡中找到开发工具,显示形状表的下拉菜单中单击。然后在Print properties 中将 PageLeftMargin,PageRightMargin,PageTopMargin,PageBottomMargin的值设置为0,然后关闭页。最后在菜单栏中单击设计,在大小下拉菜单中单击适应绘图,就会得到没有页边距的Visio图。其中后面两步前后顺序无所谓。

3. Mac上PPT作图直接保存为pdf格式,禁止文本自动换行

默认文本框内的文字在保存为pdf时会自动换行,如下面左图。点击设置对象格式,文本选项,勾掉“形状中的文字自动换行”,再次保存就为下面右图了。

  

Markdown使用

插入图片居中显示并添加图片标注:

<center> <img style="border-radius: 0.3125em; box-shadow: 0 2px 4px 0 rgba(34,36,38,.12),0 2px 10px 0 rgba(34,36,38,.08);" src="这里输入图片地址"> <br> <div style="color:orange; border-bottom: 1px solid #d9d9d9; display: inline-block; color: #999; padding: 2px;">这里输入题注</div> </center>

插入图片左对齐显示:

<img src="http://pic15.photophoto.cn/20100615/0006019058815826_b.jpg" height="330" width="495" align='left'>

控制颜色和字体等

markdown编辑器语法——文字颜色、大小、字体与背景色的设置_一步一个脚印-CSDN博客_markdown 颜色

浅红色文字:<font color="#dd0000">浅红色文字:</font><br /> 
深红色文字:<font color="#660000">深红色文字</font><br /> 
浅绿色文字:<font color="#00dd00">浅绿色文字</font><br /> 
深绿色文字:<font color="#006600">深绿色文字</font><br /> 
浅蓝色文字:<font color="#0000dd">浅蓝色文字</font><br /> 
深蓝色文字:<font color="#000066">深蓝色文字</font><br /> 
浅黄色文字:<font color="#dddd00">浅黄色文字</font><br /> 
深黄色文字:<font color="#666600">深黄色文字</font><br /> 
浅青色文字:<font color="#00dddd">浅青色文字</font><br /> 
深青色文字:<font color="#006666">深青色文字</font><br /> 
浅紫色文字:<font color="#dd00dd">浅紫色文字</font><br /> 
深紫色文字:<font color="#660066">深紫色文字</font><br /> 

如果添加颜色字体而不想换行,把后面的<br /> 去掉。

  • 3
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值