TransWikia.com

Why put the dollar sign before and after the array environment

TeX - LaTeX Asked on July 31, 2021

So I am trying to type in a table ducumenting different mathematical equations under different heading, something like this:
enter image description here
and it is suggested to me that array environment is better than table since the majority of data entry is in math mode, not text mode.

But in the answer to this question@mico wrap the array environment with single $ sign, even though that in this (website)[https://latex.wikia.org/wiki/Array_(LaTeX_environment)], the example code is not wrapped in dollar sign.

I tried to compile @mico’s code without the dollar sign and it doesn’t work. I wonder what is the role of this single dollar sign. Surely it is not meant to signal in line math mode? isn’t the whole point of array environment meant to signify that?

One Answer

As you've discovered, LaTeX must be in math mode -- either inline math mode or display math mode -- when it encounters an array environment.

In the posting which you reference in your query, the $ symbols serve to initiate and terminate inline math mode. I could have also used ( and ), or begin{math} and end{math}, to switch in and out of inline math mode.

You wrote, "I wonder what is the role of this single dollar sign." As stated in the preceding paragraph, single $ symbols may indeed be used to initiate and terminate inline math mode.

In contrast, in the wiki example which you reference, the array environment code occurs inside an array (or similar) environment. Therefore, (La)TeX is already in math mode, and there's thus no need to switch into math mode in order to process begin{array} ... end{array}. (Aside: I wrote "or similar" because the wiki code isn't actually processed by LaTeX. Instead, it is rendered by an entirely different underlying engine. )

Correct answer by Mico on July 31, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP