当前位置:网站首页>Latex improve

Latex improve

2022-07-05 08:39:00 Stay--hungry

Custom command

The custom command is LaTeX \LaTeX LATEX A very powerful function , It can greatly optimize the volume of documents .

Basic usage :

\newcommand{
    cmd}[args][default]{
    def}
  • cmd: Newly defined commands , Cannot have the same name as an existing command
  • args: Number of parameters
  • default: The first parameter ( Optional )
    ( namely #1 The default value of . You can define only one parameter 、 And the parameter contains the default value of the command .)
  • def: Specific definition content
    ( Parameters 1 With #1 Instead of , Parameters 2 With #2 Instead of …)

for example :

\newcommand{
    \hh}[1]{
    \textbf{
    #1}}
--  after `\hh{}` amount to `\textbf{}`

In fact, this grammar is equivalent to C++ Medium #define

Redefine the command
If you redefine an existing command , Use \renewcommand command , Usage and newcommand identical .

原网站

版权声明
本文为[Stay--hungry]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202140541358976.html