DEV Community

latexteada
latexteada

Posted on

LaTeX & Macros: Macros with repeated arguments

Hello, how are you? :)

In this post I tell you

  • How to declare a macros with repeated arguments

We have seen how to declare macros, how to declare macros with arguments, how to put math in macros, and how to declare macros with optional arguments

But what if there is a symbol or parameter which appears multiple times in your macros? Do we need to write it each time it appears in our macros? It would be a waste of time!!!, fortunately we can declare a repeated argument

Macros with repeated arguments

We just need to put multiple times the argument that we want to repeat in the positions where it must be. Let's see an example

Image description

Let's check this code, here I declare the instruction \dint as short of definite integral with 4 arguments

  1. The function to be integrated
  2. Here is the repeated argument it is the variable by which the integral will be done, after the differential, and under the integral symbol
  3. Inferior limit
  4. Superior limit

It produces

Image description

See? you just need to put the variable once and it appears in two places

Play with this macros and discover its limits

This is all for today.

Do not forget to follow me on Twitter @latexteada

See you. Greetings :)

Top comments (0)