vscode+latex使用记录(服务器端)

1、得安装texlive

直接网页版也可以:Log in to Overleaf - Overleaf, Online LaTeX Editor

http://t.csdnimg.cn/WKON8

然后是在vscode里面添加扩展latex。http://t.csdnimg.cn/u7qeb

太对了,只要安装这一个就行!

并且使用json文件配置一下(ctrl+shift+P打开远程设置)。

配置的内容都差不多,这是我成功的版本,没试过中文,暂且不管

{
    
    "latex-workshop.latex.tools": [
        {
            "name": "xelatex",
            "command": "xelatex",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "%DOCFILE%"
            ]
        },
        {
            "name": "pdflatex",
            "command": "pdflatex",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "%DOCFILE%"
            ]
        },
        {
            "name": "bibtex",
            "command": "bibtex",
            "args": [
                "%DOCFILE%"
            ]
        }
    ],// 编译工具和命令
    // 用于配置编译链
    "latex-workshop.latex.recipes": [
        {
            "name": "xelatex",
            "tools": [
                "xelatex"
            ],
        },
        {
            "name": "pdflatex",
            "tools": [
                "pdflatex"
            ]
        },
        {
            "name": "xe->bib->xe->xe",
            "tools": [
                "xelatex",
                "bibtex",
                "xelatex",
                "xelatex"
            ]
        },
        {
            "name": "pdf->bib->pdf->pdf",
            "tools": [
                "pdflatex",
                "bibtex",
                "pdflatex",
                "pdflatex"
            ]
        }
    ],
    "latex-workshop.view.pdf.viewer": "tab",
    "latex-workshop.latex.autoBuild.run": "onFileChange",
    "latex-workshop.message.error.show": false,
    "latex-workshop.message.warning.show": false,
    "latex-workshop.intellisense.package.enabled": true,//从使用的包中自动补全命令和环境
    "latex-workshop.latex.autoClean.run": "onBuilt",  
    "latex-workshop.latex.clean.fileTypes": [
      "*.aux",
      "*.bbl",
      "*.blg",
      "*.idx",
      "*.ind",
      "*.lof",
      "*.lot",
      "*.out",
      "*.toc",
      "*.acn",
      "*.acr",
      "*.alg",
      "*.glg",
      "*.glo",
      "*.gls",
      "*.ist",
      "*.fls",
      "*.log",
      "*.fdb_latexmk",
    ],
}

2、什么是latex的序言preamble?

http://t.csdnimg.cn/i6Dnh

在命令 \begin{document} 之前的内容,都被称为序言。

3、加粗命令: \textbf{文本}

4、裁剪pdf图片。

首先,可以使用python的matplot这个包(拼写搞忘了)保存,plt.savefig(xxx.*),*不仅可以是png,svg,还可以是pdf。然后使用texlive(已安装)自带的pdf裁剪工具,

在终端输入pdfcrop test.pdf :

会得到裁剪后的pdf图片,test-crop.pdf。

也可以输入pdfcrop  test.pdf test.pdf。那么裁剪后的文件就保存为test.pdf。

5、怎么在latex中插入图片(特指pdf形式的)并引用

在\documentclass[11pt]{article}后面(换行)加上一句\usepackage{graphicx}

然后在想要的位置插入:

\begin{figure}[ht]

  \centering

  \includegraphics[scale = 0.5]{test-crop.pdf} 

  \caption{图片标题}

  \label{fig1}

\end{figure}

这里的\label就是为了方便后续正文引用的,

使用\ref{name}即可实现图片引用,但实际应用时,好像用~\ref{name}加一个不间断空格。没太懂,但是加上了vscode不报警告

latex编译得到pdf时自动标号的。

注:

常用选项[htbp]是浮动格式:

【h】表示当前位置,将图形放置在正文文本中给出该图形环境的地方,如果本页所剩的页面不够,这一参数将不起作用。

【t】顶部。将图形放置在页面的顶部。

【b】底部。将图形放置在页面的底部。

【p】浮动页,将图形放置在一只允许有浮动对象的页面上。

一般使用【htb】这样的组合,直用【h】是没有用的。这样的组合意思就是latex会尽量满足在前面的浮动格式,就是h-t-b这个顺序,让排版的效果尽量好。

6、怎么插入脚注和链接url

插入脚注使用\footnote{xxx},xxx是注释。

插入链接\url{xxx},xxx是链接的网址。

例如:

在正文里面写:for *ACL proceedings,\footnote{\url{http://acl-org.github.io/ACLPUB/formatting.html}} and this。然后就会在proceedings,这里加上一个1的引用。这个1是latex自动编号的,不必自己写了。

7、原样插入(解释verbatim和verb)

http://t.csdnimg.cn/XdoAV

例子1:在.tex文件中输入

\begin{verbatim}

\documentclass[11pt]{article}

\end{verbatim}

然后使用pdf编译,得到的结果:

也就是.tex中\begin{verbatim} xxxx \end{verbatim}写的是什么(xxx),转成pdf还是什么(xxx)。

这种输入比较麻烦,因此有一个它的简便方法:\verb|xxx|,也能实现‘写的是什么(xxx),转成pdf还是什么(xxx)’。区别我暂时不知道,感觉都能用。

8、引用格式说明\begin{quote}

http://t.csdnimg.cn/2i2y3

例子:

The first line of the file must be

\begin{quote}

\begin{verbatim}

\documentclass[11pt]{article}

\end{verbatim}

\end{quote}

To load the style file in the review version:

红色的就是加了quote,绿色的就是没加。它实际是改了缩进。

9、\cite{}和\citet{}的区别

http://t.csdnimg.cn/gGmNn

http://t.csdnimg.cn/13Qy5

10.字体加粗\textbf{}

http://t.csdnimg.cn/7xsRT

11、破折号

在latex的.tex中输入---,编译pdf可以得到中文的破折号——

12、bib中引用的人名姓氏问题

很容易搞混。写了只是提醒我注意这个问题,没打算看完就懂。

(1)A,B形式

@inproceedings{Self-MM,
  title={Learning modality-specific representations with self-supervised multi-task learning for multimodal sentiment analysis},
  author={Yu, Wenmeng and Xu, Hua and Yuan, Ziqi and Wu, Jiele},
  booktitle={Proceedings of the AAAI conference on artificial intelligence},
  volume={35},
  number={12},
  pages={10790--10797},
  year={2021}
}

这个里面,根据中文习惯能知道Yu是姓,Wenmeng是名。

但是得到的pdf中是

@article{transformer,
    title={Attention is all you need},
    author={Vaswani, Ashish and Shazeer, Noam and Parmar, Niki and Uszkoreit, Jakob and Jones, Llion and Gomez, Aidan N and Kaiser, {\L}ukasz and Polosukhin, Illia},
    journal={Advances in neural information processing systems},
    volume={30},
    year={2017}
}

这里也是Vaswani是姓氏。

理论上A,B这种,A就是姓氏。

(2)A B这种

@inproceedings{Graph_Fusion,
    title = {Modality to Modality Translation: An Adversarial Representation Learning and Graph Fusion Network for Multimodal Fusion},
    author = "Sijie Mai and Haifeng Hu and Songlong Xing",
    booktitle = {The Thirty-Fourth {AAAI} Conference on Artificial Intelligence, {AAAI} 2020},
    pages = {164--172},
    year = {2020},
}

这里是Mai是姓氏。

@article{MISA,
  title={MISA: Modality-Invariant and -Specific Representations for Multimodal Sentiment Analysis},
  author={Devamanyu Hazarika and Roger Zimmermann and Soujanya Poria},
  journal={Proceedings of the 28th ACM International Conference on Multimedia},
  year={2020},
}

这里面Hazarika是姓氏。

A B这种,B是姓氏。

  • 6
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值