LaTeX forum ⇒ Text FormattingCreate an array macro

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
danielvelizv
Posts: 45
Joined: Wed May 25, 2016 7:04 am

Create an array macro

Postby danielvelizv » Wed Sep 07, 2016 3:56 am

I need to create a macro with array environment that contents 3 columns and all its elements are \displaystyle ones, something I can use repeatedly throughout a document. Any idea to do that?

Tags:

User avatar
Stefan Kottwitz
Site Admin
Posts: 9406
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Fri Sep 09, 2016 5:01 pm

Here's an example:

  1. % in the preamble:
  2. \usepackage{multienum}
  3. \settowidth{\labelwidth}{\textbf{1.99)}}
  4. ...
  5. \begin{multienumerate}
  6. \everymath{\displaystyle}
  7. \renewcommand{\labelenumi}{\addtocounter{multienumi}{1}\textbf{1.\arabic{multienumi})}}
  8. \mitemxxx
  9. {$\int 2x - 3x^2\,dx$}
  10. {$\int 2x - 3x^2\,dx$}
  11. {$\int x^{3/2} + 2x + 1\,dx$}
  12. \mitemxxx
  13. {$\int \frac{\sqrt{5x}}{5} + \frac{5}{\sqrt{5x}}\,dx$}
  14. {$\int (2t^2 - 1)^2\,dt$}
  15. {$\int 2 \sen x + 3 \cos x\,dx$}
  16. \end{multienumerate}


multiple-item-list.png
multiple-item-list.png (10.31 KiB) Viewed 1660 times


Stefan
Site admin

User avatar
cgnieder
Site Moderator
Posts: 1988
Joined: Sat Apr 16, 2011 7:27 pm

Postby cgnieder » Wed Sep 21, 2016 9:04 pm

Another idea:

  1. \documentclass{article}
  2.  
  3. \usepackage{tasks}
  4.  
  5. \begin{document}
  6.  
  7. \begin{tasks}[item-format=\everymath{\displaystyle}](3)
  8. \task $\int 2x - 3x^2\,dx$
  9. \task $\int 2x - 3x^2\,dx$
  10. \task $\int x^{3/2} + 2x + 1\,dx$
  11. \task $\int \frac{\sqrt{5x}}{5} + \frac{5}{\sqrt{5x}}\,dx$
  12. \task $\int (2t^2 - 1)^2\,dt$
  13. \task $\int 2 \sin x + 3 \cos x\,dx$
  14. \end{tasks}
  15.  
  16. \end{document}


tasks.png
tasks.png (10.06 KiB) Viewed 1611 times


Regards
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim


Return to “Text Formatting”

Who is online

Users browsing this forum: No registered users and 4 guests