Math & ScienceAvoiding a 'split up' equation

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
Seanshine
Posts: 52
Joined: Sat Apr 28, 2018 9:59 pm

Avoiding a 'split up' equation

Post by Seanshine »

Dear readers,

I am trying to fit in a rather long vector of variables, but LaTeX splits up the vector, while this is not necessary as there appears to be plenty of space on one line. How can one avoid this?

Code: Select all

\intertext{The vector of parameters to be estimated by maximum likelihood is as follows:}
\begin{align*}
\boldsymbol{\theta}_{2} =   \begin{bmatrix}
a_{y,1} & a_{y,2} & a_{r} & a_{0} & a_{g} & b_{\pi} & b_{y} & g & \sigma_{\Tilde{y}} & \sigma_{\pi} & \sigma_{y^{*}}
                            \end{bmatrix}
\end{align*}
Furthmore, maybe off-topic, but why does \intertext (while amsmath package is in the preamble) not work?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Avoiding a 'split up' equation

Post by Johannes_B »

Doesn't work that way. I can fit everything perfectly on a page that is three meters wide.

Page margins? Page size? Document class? minimal working example?
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Seanshine
Posts: 52
Joined: Sat Apr 28, 2018 9:59 pm

Avoiding a 'split up' equation

Post by Seanshine »

Hi Johannes,

As requested:

Code: Select all

\documentclass[
11pt,english, onehalfspacing, nolistspacing, liststotoc, headsepline,oneside, 
chapterinoneline, leqno, a4paper 
%consistentlayout, change the layout of the declaration, abstract and acknowledgements pages to match the default layout
]{MastersDoctoralThesis}

\voffset = -2.54cm
\hoffset = -2.54cm
\textheight 23cm
\textwidth 16 cm
\topmargin 2.5cm
\oddsidemargin 2.50cm \evensidemargin 2.5cm \unitlength 1cm
Best, Sean
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Avoiding a 'split up' equation

Post by Johannes_B »

Wombat=-.314Capybara

//Written while at a BBQ.

What do you expext? Mind readers? You are using the low-level interface, instead of the high leve interface.
And still no working example.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Seanshine
Posts: 52
Joined: Sat Apr 28, 2018 9:59 pm

Avoiding a 'split up' equation

Post by Seanshine »

Nice, enjoy the BBQ.

What interface?

This one?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Avoiding a 'split up' equation

Post by Stefan Kottwitz »

Hi Sean!

I guess the low-level interface means using the commands \voffset, ..., \evensidemargin etc. That's stone age TeX and can lead to issues easily. It's better to use the geometry package and the \geometry command with options.

Have a look at this link, about why and how to provide code: Infominimal working example

\intertext works within an align environment. You used it outside, that's why it doesn't work.

align* is not useful here since there's no alignment.

Furthermore, the matrix has more than 10 columns, that's the default maximum. You can raise it, such as by setting \setcounter{MaxMatrixCols}{11}.

Working code:

Code: Select all

\documentclass{article}
\usepackage{amsmath}
\setcounter{MaxMatrixCols}{11}
\begin{document}
\begin{align*}
\intertext{The vector of parameters to be estimated by maximum
likelihood is as follows:}
\end{align*}
\[
\boldsymbol{\theta}_{2} = \begin{bmatrix}
  a_{y,1} & a_{y,2} & a_{r} & a_{0} & a_{g} & b_{\pi} & b_{y} & g
  & \sigma_{\Tilde{y}} & \sigma_{\pi} & \sigma_{y^{*}}
                          \end{bmatrix}
\]
\end{document}
I used the align* environment only to show how \intertext works. It is for text between several lines within a multi-line formula or equation.

Stefan
LaTeX.org admin
Seanshine
Posts: 52
Joined: Sat Apr 28, 2018 9:59 pm

Avoiding a 'split up' equation

Post by Seanshine »

Thanks Stefan! The column problem has been solved.

I did not know once could put text within the alignment environment and use \[ and \] around the mathematical expressions. Another thing learned!

How would one set-up the geometry to achieve the same margins?

\geometry{
paper=a4paper, % Change to letterpaper for US letter
inner=1.5cm, % Inner margin
outer=2.5cm, % Outer margin
bindingoffset=0.5cm, % Binding offset
top=0.5cm, % Top margin
bottom=1.0cm, % Bottom margin
}
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Avoiding a 'split up' equation

Post by Stefan Kottwitz »

I suggest just read the geometry manual to become aware of the options and how they work. It's good anyway in case you need changes later. One good point with geometry is, that it automatically calculates missing values, for example if you specify top and bottom margin, it calculates the text area height based on the paper size. And more values, such as footnote separation and head height for header etc. If one sets values manually, it can easily be that for example text height plus margins just don't fit the paper height.

Stefan
LaTeX.org admin
Post Reply