在 LaTeX 中定义变量

7 篇文章 2 订阅
4 篇文章 0 订阅

介绍

在撰写科研论文时,我们经常给自己的模型起一个方便使用的名字,例如 ResNet 等。通常这个模型名字(或者其他类似的东西)会在论文中出现多次。我们在写论文的时候,可能有时候

  • 需要换个模型名
  • 输错了模型名

那么,使用变量来定义模型的名字就非常方便了。本篇博客介绍如何在 LaTeX \LaTeX LATEX 中定义变量。

用法

首先直接定义一个新的命令:

\newcommand{\M}{ResNet}

然后使用 \M(或者其他符号) 来表示你所定义的模型名,例如ResNet

This is the \M~framework.

注意

在命令之后直接跟空格,会忽略掉这个空格,此时应该用~符号代替空格。例如,\M framework的输出是ResNetframework,而\M~framework的输出是ResNet framework

示例

在这里插入图片描述

代码

\documentclass{article}
\usepackage[utf8]{inputenc}

\newcommand{\M}{ResNet}

\title{\textbf{An Introduction to \M}}
\author{Xovee Xu}
\date{December 2020}

\begin{document}

\maketitle

\section{Introduction}

This article explains how to write the word \M~\cite{he2016deep}. Now you know how to type \M, congrats!

And a tip: if there is a space after the name of \M~then you should use ``\verb|~|'' character to substitute the space ``\verb| |''. For example, \verb|a ResNet~network| is the right code and \verb|a ResNet network| is the wrong code and will result in \verb|a ResNetnetwork|.

\bibliography{name}
\bibliographystyle{plain}

\end{document}

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Xovee

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值