Is it possible to wrap an equation to a new line (such as in How to wrap a long equation in latex but within an array environment? I have a column vector of regressors that I want to show over two rows. My code without wrapping looks like this


I'd like it to look something like:

X = [var1 var2 var3 var4
        ... var5 var6 var7 var8]^T

1 Answer 1


You could use the multline environment of the amsmath package. The example below uses a simple interword space to separate the variables; depending on your needs and preferences you may want to increase the separation a bit.

enter image description here

\usepackage{amsmath} % Required for multline environment
\newcommand\V[1]{\textup{#1}} % Variable names in upright roman
  \V{CitySize}_i \ 
  \V{NoMotorways}_i \ 
  \V{ElevatedMotorways}_i \ 
  \V{SpeedLimit}_i \\
  \V{Policing}_i \ 
  \V{TrafficLights}_i \  
  \V{TransitLanesTrue}_i \  
  \V{Aggression}_i \,

\hrule  % just to show width of text block
  • Use of \newcommand is very useful too. Is it easiest, in general, to use multiline when splitting large vectors or matrices? I was hoping there would be a way to wrap these without having to do it by hand.
    – oLas
    Commented Jan 3, 2014 at 15:02
  • 1
    @oLas - Notice that my answer pertains only to splitting a lengthy row vector; I didn's say anything about matrices... In my experience, it's usually best to select the line breaks using the eyeball method (aka the "Nike Strategy", viz., "Just Do It"). Choosing line breaks that are pleasing aesthetically as well as correct mathematically is both an art and a craft; fiddling with the settings of an algorithm that's supposed to select the line breaks tends to take up more time than is required for doing the job by hand.
    – Mico
    Commented Jan 3, 2014 at 15:14
  • @oLas - Thanks for he suggested edit. Do note that the name of the equation-related environment is multline, not multiline.
    – Mico
    Commented Jan 8, 2014 at 3:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .