23

Is there a way to make every element of an array be \displaystyle? I don't want to do something like \everymath={\displaystyle} (or whatever it should be) because I want this for a particular array only. Also, one of the column specifications is p{5cm} which makes it text mode. So that column shouldn't be \displaystyle. (Or rather, the solution shouldn't choke on a text column.

Any bright ideas?

2 Answers 2

41

You could insert \displaystyle into the column definition, such as

\begin{array}{*3{>{\displaystyle}c}p{5cm}}

Here I used syntax provided by the array package:

  • >{...} can insert commands before the array element
  • *n{...} repeats a column definition n times

So in the example we get 3 columns, where all cells have \displaystyle, and 1 paragraph column without.

5
  • 1
    I really have to learn more about the cool stuff the array package can do! Commented Feb 13, 2012 at 15:05
  • 3
    When I use this inside a beamer frame it gives me errors "illegal character in array arg"... Commented Feb 19, 2016 at 3:27
  • 3
    I also get "Illegal character in array arg." Commented Jun 9, 2016 at 12:00
  • 5
    @ahorn Load the array package. Commented Jun 9, 2016 at 13:14
  • 1
    Thank you. Without your comment, I was considering opening a bounty. Commented Jun 9, 2016 at 17:31
13

You can use \everymath inside a scope:

{ \everymath={\displaystyle}
  Inside:

  \(
     \begin{array}{cc}
       \frac12 & \frac12
     \end{array}
  \)
}

\medskip
Outside:

\(\frac12\)

Output

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.