Forgot password
 Register account
View 2576|Reply 4

latex里怎么用加法?

[Copy link]

414

Threads

1641

Posts

15

Reputation

Show all posts

abababa posted 2017-8-19 09:46 |Read mode
用\ding{172}可以输入带圈数字1,然后我想定义一个新的命令,用\newcommand{\myding}[1]{\ding{171+#1}},想以后用\myding{1}时就是输入带圈数字1。请教这里这个加法应该怎么弄?

673

Threads

110K

Posts

218

Reputation

Show all posts

kuing posted 2017-8-19 12:13
\newcommand\myding[1]{\ding{\numexpr171+#1\relax}}

414

Threads

1641

Posts

15

Reputation

Show all posts

original poster abababa posted 2017-8-19 14:28
回复 2# kuing
谢谢,弄好了。

673

Threads

110K

Posts

218

Reputation

Show all posts

kuing posted 2017-8-19 15:33
BTW,除了 \numexpr 外,还有 \dimexpr 用于长度运算,写法也一样:\dimexpr ... \relax ,有时 \relax 可以省略,但建议不省。

这些都不需要宏包支持,之前重写的不依赖宏包的选择题排版代码就是利用它来改写的。

414

Threads

1641

Posts

15

Reputation

Show all posts

original poster abababa posted 2017-8-20 08:37
回复 4# kuing

原来方法挺多的,我会一种就行了,并且深入的还不明白,先能用就好。

Quick Reply

Advanced Mode
B Color Image Link Quote Code Smilies
You have to log in before you can reply Login | Register account

$\LaTeX$ formula tutorial

Mobile version

2025-7-21 05:39 GMT+8

Powered by Discuz!

Processed in 0.012611 seconds, 22 queries