latex tips

All kinds of details regarding to use the latex in writing paper.

表格

注意在表格编译的时候 ccc的地方标记的是具体有多少列 这个小错误很容易忽略然后造成表格显示不全面 l r c 表示 左右或者居中

双栏排版中 表格放在单栏 并且居中

\begin{table*}[htbp]
\centering
\begin{tabular}{| l | l | l | l | l | l | l | }
\hline
Number of Node & 2 & 4 & 16 & 32 & 64 & 128 \\ \hline
Number of Server Process & 16 & 32 & 256 & 512 & 1024 & 8192 \\ \hline
Number of Work Load & 256$\times$16 & 256$\times$32 & 256$\times$256 & 256$\times$512 & 256$\times$1024 & 256$\times$8192 \\ \hline
\end{tabular}
\caption{Experiment setup for weak scaling}\label{tab:weaksetup}
\end{table*}

refer to https://blog.csdn.net/zjccsg/article/details/51926069

表格宽度

refer to
https://blog.csdn.net/ProgramChangesWorld/article/details/51867351

控制表格宽度的例子

\begin{table}[h]
\caption{User Interfaces}
\label{tab:interfaces}
\centering
\begin{tabular}{|p{3cm}|p{5cm}|}
\hline
topic\_subscribe & subscribe event with topic based messages \\
\hline
data\_subscribe & subscribe event with customized scripts for data properties \\
\hline
topic\_unsubscibe & unsubscribe event with topic based messages \\
\hline
data\_unsubscribe & unsubscribe event with customized scripts for data properties \\
\hline
publish & publish event with topic based event messages \\
\hline
notify & send notification to the operator to trigger the action related with this notification \\
\hline
\end{tabular}
\end{table}

制作表头的例子

https://tex.stackexchange.com/questions/110018/professional-slashbox-alternative

一个非常好看的表格的例子,中间省略掉了多余的线,表头部分重点标记出来,看起来比默认的表格形式好很多。

\begin{table*}[ht]
\begin{center}
\caption {Adding captions here}

\begin{tabular}{lllllll}
\toprule
Approach & Distribution & Serial & OpenMP & CUDA & Kokkos\_CUDA & Kokkos\_HIP \\ \midrule
\multirow{3}{*}{Reduce by key} & Uniform & $24363$ & $713$ ($34\times$) & $635$ ($\mathbf{38\times}$) & $3188$ ($7\times$)& $1423$ ($17\times$)\\
& IndependentG & $25117$ & $716$ ($35\times$) & $624$ ($\mathbf{40\times}$) & $3183$ ($7\times$) & $1475$ ($17\times$)\\
& MultivariateG ($1000$ samples) & $24996$ & $725$ ($\mathbf{34\times}$)& $826$ ($30\times$)& $3351$ ($7\times$) & $1454$ ($17\times$)\\
\midrule
\multirow{3}{*}{Fixed block size} & Uniform & $1075$ & $91$ ($11\times$) & $171$ ($6\times$)& $147$ ($7\times$)& $74$ ($\mathbf{14\times}$)\\
& IndependentG & $1609$ & $92$ ($17\times$)& $171$ ($9\times$)& $155$ ($10\times$)& $78$ ($\mathbf{20\times}$)\\
& MultivariateG ($1000$ samples) & $1444$ & $93$ ($15\times$)& $357$ ($4\times$)& $302$ ($4\times$)& $94$ ($\mathbf{15\times}$)\\
\bottomrule
\end{tabular}
\end{center}
\end{table*}

公式

公式换行 注意使用 split + & + \

refer to

https://stackoverflow.com/questions/2860145/how-can-i-have-linebreaks-in-my-long-latex-equations

或者使用一些特定的library来实现自动换行,比如 amsmath 或者 multline

Break the how tex into several pices

Spliting latex into several pieces might be good for people that use latex locally to compile all things. Things updates of one file will not influences others. If only using one latex file, it is easy to get the conflictx in the file.

using \input{some lax file} can split the table into a separate latex file and insert into the main latex file.

According to this answer
https://tex.stackexchange.com/questions/246/when-should-i-use-input-vs-include

The include will add a clearpage operation

使用item

example:

\begin{itemize}[noitemsep,leftmargin=*]

\item We design and implement the scalable topic based Pub/Sub broker based on dynamic group management.

\item We use the dynamic data redistribution mechanism to solve the load imbalance issue for topic based Pub/Sub when there is large subscribers.

\item We provide the architecture for event based framework to construct the workflow based on event based task dependency.

\item We implement the data centric Pub/Sub mechanism letting user provide customized scripts (predicates) for multiple backend data storage service during subscription, when interesting patten described in scripts happen, the subscriber will be notified and following task will be triggered.

\end{itemize}

通过leftmargin可以让不同的item产生左对齐的效果

figures

2*2 subfigures across multiple columns, there are lots of online resource, this one works best

\usepackage{graphicx}
\usepackage{subfigure}


\begin{figure*}
\centering %%% not \center
\subfigure[Figure A]{\label{fig:a}\includegraphics[width=85mm]{./submission/figure/umlmcp.pdf}}
\subfigure[Figure B]{\label{fig:b}\includegraphics[width=85mm]{./submission/figure/umlmcp.pdf}}
\subfigure[Figure C]{\label{fig:b}\includegraphics[width=85mm]{./submission/figure/umlmcp.pdf}}
\hspace{0.12in}
\subfigure[Figure D]{\label{fig:b}\includegraphics[width=85mm]{./submission/figure/umlmcp.pdf}}
\caption{my caption}
\end{figure*}

using hspace between the two subgraphics could control the distance between two pictures.

vspace and shrink the paper

When finish the paper, at last, you need to adjust the content to make it fit the page size, how to make it to fit the size perfectly? The first is that use the [h] to make all the figure al the top of the page. Second is to use the vspace command wisely, by this way, you could adjust it properly according to the content of the data. It is always good to set the table at the top of the specific page

Other techniques include adjusting the reference, for example, use the simplified version for the reference can decrease the paper length in a large amount. In most cases, one reference item should be 2-3 lines, if it is 5 lines, it might be too long and we can choose proper reference format to decrease its length.

其他

补充:

添加comment的技巧

导出图片的时候要弄成pdf的形式 而不是 png或者是jpg的形式 pdf的形式 效果会更清晰

开始一个新的段落的时候不要求额外的缩进 使用这个符号 ~\\

latex插入多张图片 并排或者竖放

https://blog.csdn.net/a6822342/article/details/80533135

注意中间的空格

推荐文章