Latex相关使用的学习
Latex使用过程中一些有用的
公式相关
图片相关
1.双栏写作时,图片占两列
\begin{figure*} %figure*实现图片占两列 \centering \begin{subfigure}{\linewidth} \centering % \fbox{\rule{0pt}{2in} \rule{.9\linewidth}{0pt}} \includegraphics[width=0.8\linewidth]{sec/pic/fig2.jpg} % \caption{An example of a subfigure.} \label{fig:short-a} \end{subfigure} % \hfill % \begin{subfigure}{0.28\linewidth} % \fbox{\rule{0pt}{2in} \rule{.9\linewidth}{0pt}} % \caption{Another example of a subfigure.} % \label{fig:short-b} % \end{subfigure} \caption{Overview of the proposed framework.} \label{fig:fig_framework} \end{figure*}
2.多个图片组合
subfigure
环境被用来分割 figure,并且使用 \caption
添加每张图像的标题。twocolumn
选项用于设置双栏格式。
% \documentclass[twocolumn]{article} % \usepackage{graphicx} % \usepackage{subcaption} % htbp使图片尽可能图像尽可能地保持在原位,可以使用 [htbp] 选项。这些选项分别代表: % h: 在当前位置放置图像 % t: 放置在页面顶部 % b: 放置在页面底部 % p: 在单独的页面上放置图像 \begin{document} \begin{figure}[htbp] \centering \begin{subfigure}[t]{0.2\textwidth} % 左侧 minipage \centering \includegraphics[width=\textwidth]{sec/pic/4-2a.jpg} \caption{} \label{fig:comp_exp_a} \end{subfigure} \hfill \begin{subfigure}[t]{0.2\textwidth} % 右侧 minipage \centering \includegraphics[width=\textwidth]{sec/pic/4-2b.jpg} \caption{} \label{fig:comp_exp_b} \end{subfigure} \begin{subfigure}[t]{0.2\textwidth} % 左侧 minipage \centering \includegraphics[width=\textwidth]{sec/pic/4-2c.jpg} \caption{} \label{fig:comp_exp_c} \end{subfigure} \hfill \begin{subfigure}[t]{0.2\textwidth} % 右侧 minipage \centering \includegraphics[width=\textwidth]{sec/pic/4-2d.jpg} \caption{} \label{fig:comp_exp_d} \end{subfigure} \caption{Figures (a) and (b) show the results of Experiment 1 with LUAD \cite{39} as the source domain in the TNBC \cite{40} target domain test set; (c) and (d) show the results of Experiment 1 with LUAD \cite{39} as the source domain in the LUNG\_SEG\_2 target domain test set} \label{fig:fig4-2} \end{figure} \end{document}
表相关
表推荐一个网站进行转格式:
Create LaTeX tables online – TablesGenerator.com
上面一栏的工具栏功能和excel差不多,居中,添加单元格边框,合并单元格等操作
1.表的多个单元格合并
主要是需要导入一下\usepackage{multirow}
% Please add the following required packages to your document preamble: % \usepackage{multirow} % \usepackage{graphicx} \begin{table}[] \resizebox{\columnwidth}{!}{% \begin{tabular}{c|cccc} \hline {\multirow{3}{*}{Methods}} & \multicolumn{4}{c}{LUAD\cite{39}} \\ {} & \multicolumn{2}{c}{TNBC\cite{40}} & \multicolumn{2}{c}{LUNG\_SEG\_2} \\ {} & IoU\% & Dice score & IoU\% & Dice score \\ \hline {U-Net\cite{28}} & 37.13 & 0.5299 & 44.19 & 0.6025 \\ {U-Net\cite{28} with Dice-coefficient Loss} & 50.01 & 0.6615 & 51.67 & 0.6707 \\ {U-Net\cite{28} with Adversarial Learning} & 51.12 & 0.6647 & 51.24 & 0.6673 \\ {U-Net\cite{28} with Augmentation} & 52.95 & 0.6841 & 51.06 & 0.6651 \\ \textbf{Ours} & 62.59 & 0.7672 & 57.22 & 0.7152 \\ \hline \multicolumn{1}{l}{} & \multicolumn{1}{l}{} & \multicolumn{1}{l}{} & \multicolumn{1}{l}{} & \multicolumn{1}{l}{} \end{tabular}% } \caption{Results of ablation experiments with LUAD \cite{39} as the source domain} \label{tab:tab4-5} \end{table} \begin{table}[] \resizebox{\columnwidth}{!}{% \begin{tabular}{c|cccc} \hline \multirow{3}{*}{Methods} & \multicolumn{4}{c}{LUSC\cite{39}} \\ & \multicolumn{2}{c}{TNBC\cite{40}} & \multicolumn{2}{c}{LUNG\_SEG\_2} \\ & IoU\% & Dice score & IoU\% & Dice score \\ \hline U-Net\cite{28} & 38.84 & 0.5489 & 44.3 & 0.6041 \\ U-Net\cite{28} with Dice-coefficient Loss & 51.01 & 0.6694 & 51.98 & 0.6735 \\ U-Net\cite{28} with Adversarial Learning & 50.41 & 0.6582 & 51.48 & 0.6691 \\ U-Net\cite{28} with Augmentation & 53.58 & 0.6886 & 51.01 & 0.6648 \\ \textbf{Ours} & 62.65 & 0.7681 & 57.59 & 0.7189 \\ \hline \end{tabular}% } \caption{Results of ablation experiments with LUSC \cite{39} as the source domain} \label{tab:tab4-6} \end{table}
参考文献相关
1.Word转Bib
由于是先有Word中的参考文献,按照gb7714格式的参考文献,需要转成Latex中的bib格式,因此在网上查找到相关脚本,以及使用方法,参考如何将GB7714-2015格式的参考文献表转换为bib文件_windows系统中的latex如何使用gb7714texttobib-CSDN博客
为防丢失,自己再记录一下。
转换需要用到
- Strawberry Perl for Windows
- 【GitHub】gb7714texttobib.pl 这个工具是perl写的
- 如果打开很慢,试试百度云链接: https://pan.baidu.com/s/18Qbh39TeqUOvY8QILzIVTw?pwd=AaBb 提取码: AaBb 复制这段内容后打开百度网盘手机App,操作更方便哦
在命令行中运行:
perl gb7714texttobib.pl in=textfilename out=bibfilename
我们已经有了gb格式的参考文献文本,在a.txt文件中。如果转换后输出的文件名为c.BIB,那么使用如下命令进行转换:
perl gb7714texttobib.pl in=a.txt out=c.BIB
有同学可能没有看懂上面的使用方法,这里再补充解释一下。
gb7714texttobib.pl
工具实际就是一个perl脚本,要执行perl脚本,需要perl环境(perl执行程序)。对于linux通常系统会自带的。对于windows系统通常系统不自带,所以需要有这个环境,如果安装使用texlive,那么就已经有了,不需要再操作了,因为texlive也依赖于perl环境,安装过程中就已经具备了perl环境。如果没有使用texlive,那么需要额外安装一个perl环境,比如Strawberry Perl for Windows,网上一搜就有,安装一下。
在完成脚本和环境准备后,那么就是执行脚本的问题。
假设有一个文件夹下放了一个a.txt文件包含了国标格式的文献信息需要转换。如果gb7714texttobib.pl也在这个文件夹下,那么在当前目录下的终端(命令行)执行命令(即终端|命令行当前的目录就是这个放了a.txt文件的目录):
perl gb7714texttobib.pl in=a.txt out=a.BIB
如果gb7714texttobib.pl放到了其它地方(比如d:/gb7714texttobib.pl),那么指定这个路径即可:
perl d:/gb7714texttobib.pl in=a.txt out=a.BIB
对于a.txt文件
[1] Ganin Y, Lempitsky V. Unsupervised domain adaptation by backpropagation[C]. In Proc. of the 32nd International Conference on Machine Learning, 2015: 1180-1189. [2] Tzeng E, Hoffman J, et al. Adversarial discriminative domain adaptation[C]. In Proc. of the 30th IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2017: 2962-2971.
转换结果为:
c.BIB文件:
% Encoding: UTF-8 @proceedings{Ganin2015, author = {Ganin, Y and Lempitsky, V }, title = {Unsupervised domain adaptation by backpropagation}, publisher = {In Proc. of the 32nd International Conference on Machine Learning}, date = {2015}, pages = { 1180-1189}, } @proceedings{Tzeng2017, author = {Tzeng, E and Hoffman, J and others}, title = {Adversarial discriminative domain adaptation}, publisher = {In Proc. of the 30th IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)}, date = {2017}, pages = { 2962-2971}, }
需要注意的是,在使用过程中,perl工具可能对读入的文件有编码要求,比如要求a.txt文件是utf8编码的。但若给出的文件是gbk编码的,可能会报错,比如:
Locale 'Chinese (Simplified)_China.936' is unsupported, and may crash the interpreter.
若产生这种报错,那么只要把保存文献信息的文件,也就是前面例子中的 a.txt文件的编码改成utf8编码即可。
本文来自博客园,作者:chendsome,转载请注明原文链接:https://www.cnblogs.com/chendsome/p/18580664
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构