Latex的一些问题

宏定义

\def
\long\def, \long 一般的宏是不允许使用分段符号\par来充当参数的。要允许宏接收分段符号充当参数,那就在\def前面增加一个\long.

\def和\newcommand的区别

  • \newcommand is part of LaTeX; \def is part of TeX.
  • \newcommand fails if the command is already defined; \def doesn’t.
  • \newcommand provides a convenient syntax for specifying the number of arguments, and specifying a (single) optional argument; \def enables pattern-matching on the form of its arguments, which makes it more general but also less readable.
  • \newcommand can’t define a command whose name starts with “end”; \def can.
  • \newcommand defines “long” commands; \def (unless \long\def is used) defines short ones. (The arguments of a “long” command can include paragraph breaks.)

See: What is the difference between \def and \newcommand?

Warning–entry type for “…” isn’t style-file defined

说明你bib里有一条entry的类型在你的reference格式里不支持. 比如@dataset, @webpage等. 可以换成@misc

警告有文献没有正确引用, 但是bib里有

应该是你的bst文件里要求year, 但是entry里缺year这个item, 手动添加就好.

使用Times New Roman

latex自己是不带Times New Roman这个字体的. 所以要借助其他方法实现

  1. 使用\usepackage{mathptmx}包, 可以呈现类似Times New Roman的效果, 或者
  2. 使用XeLaTeX编译器, 然后使用如下命令(详情看这里):
\usepackage{fontspec}
\setmainfont{Times New Roman}

段间距与行间距

\setlength{\lineskip}{1em} 设置行间距
\setlength{\parskip}{2em} 设置段落间距

设置缩进

\setlength{\parindent}{0pt} 之后的所有段落都将取消缩进
\noindent 只取消该段的首行缩进

设置页边框

\usepackage{geometry}
\geometry{left=3.18cm,right=3.18cm,top=2.54cm,bottom=2.54cm} % a4, normal margin

latex插入随机英语文本

\usepackage{kantlipsum}
\kant[1-5] % 1-5段

latex按原样输出

比如要直接输出一些命令, 类似markdown\noindent这种的话, 可以使用verbatim包. 不然latex会自动把它当成命令而没法输出.

\usepackage{verbatim}
\begin{verbatim}
\noindent
\end{verbatim}

如果不使用块命令的话, 可以用短命令 \verb|\noindent|
另外\texttt{}也可以实现类似功能, 但是\texttt{}会自动去掉括号内的空格, 也允许换行.

latex输入右斜线

需要使用命令\textbackslash来输入\

Latex去掉ACM模板的copyright部分

\setcopyright{none}
\makeatletter
\renewcommand\@formatdoi[1]{\ignorespaces}
\makeatother
\settopmatter{printacmref=false} % remove citation
\renewcommand{\footnotetextcopyrightpermission}[1]{} % remove copyright
\pagestyle{plain}

去掉ACM模板的页眉

去acmart.cls中把\pagestyle{standardpagestyle}改成\pagestyle{empty}
如果想要页码, 就改成\pagestyle{plain}

靠右对齐

居中的话直接用\centering就可以了.
靠右可以使用

\begin{flushright}
...
\end{flushright}

此方法对于图片也适用
如果只需要一行对齐, 可以使用 \rightline{text}

输入尖括号

latex里直接使用<>属于非法字符, 转义过后也不行. 如果想使用的话可以利用数学公式:
\langle \rangle 来表示.

ACM 模板显示页数

在\maketitle前加上:
\settopmatter{printfolios=true}

Command `\Bbbk’ already defined

amssymb包前面加上一个命令让Bbbk失效.

\let\Bbbk\relax
\usepackage{amssymb}
  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值