Forgot password?
 Create new account
View 129|Reply 1

TeX command \if

[Copy link]

3146

Threads

8493

Posts

610K

Credits

Credits
66158
QQ

Show all posts

hbghlyj Posted at 2023-4-30 00:28:52 |Read mode
WikiBook的说明
\if 测试字符编码是否相等。
\ifx 测试字符编码与分类码是否都相等。
\let 将一个控制序列定义为一个记号的同义词。

例1
  1. \documentclass[preview,border=1]{standalone}
  2. \begin{document}
  3. \let\a=a
  4. \def\b{a}
  5. \if \a \b
  6. same
  7. \else
  8. different
  9. \fi
  10. \end{document}
Copy the Code

例2
  1. \documentclass[preview,border=1]{standalone}
  2. \usepackage{amsthm}
  3. \begin{document}
  4. \if \qedsymbol \openbox
  5. same
  6. \else
  7. different
  8. \fi
  9. \end{document}
Copy the Code

为什么例1生成的PDF只有一个same, 而例2生成的PDF除了same还有两个$\Box$呢?

3146

Threads

8493

Posts

610K

Credits

Credits
66158
QQ

Show all posts

 Author| hbghlyj Posted at 2023-4-30 00:43:47
例3
  1. \documentclass[preview,border=1]{standalone}
  2. \begin{document}
  3. \def\a{%
  4.   \makebox[1cm]{%
  5.   \setlength{\unitlength}{1cm}
  6.     \begin{picture}(1,1)
  7.     \put(0,0){\line(0,1){1}}
  8.     \put(0,0){\line(1,0){1}}
  9.     \put(0,0){\line(1,1){1}}
  10.     \end{picture}
  11.   }
  12. }
  13. \if \a \a
  14. same
  15. \else
  16. different
  17. \fi
  18. \end{document}
Copy the Code

为什么生成的PDF前面还有一个$\Omega$呢

手机版Mobile version|Leisure Math Forum

2025-4-20 22:08 GMT+8

Powered by Discuz!

× Quick Reply To Top Return to the list