LaTeX forum ⇒ Math & ScienceAvoiding a 'split up' equation

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

Avoiding a 'split up' equation

Postby Seanshine » Sun Jun 03, 2018 5:26 pm

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?

  1. \intertext{The vector of parameters to be estimated by maximum likelihood is as follows:}
  2. \begin{align*}
  3. \boldsymbol{\theta}_{2} = \begin{bmatrix}
  4. a_{y,1} & a_{y,2} & a_{r} & a_{0} & a_{g} & b_{\pi} & b_{y} & g & \sigma_{\Tilde{y}} & \sigma_{\pi} & \sigma_{y^{*}}
  5. \end{bmatrix}
  6. \end{align*}


Furthmore, maybe off-topic, but why does \intertext (while amsmath package is in the preamble) not work?

Tags:

User avatar
Johannes_B
Site Moderator
Posts: 3763
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Sun Jun 03, 2018 6:41 pm

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: 22
Joined: Sat Apr 28, 2018 9:59 pm

Postby Seanshine » Sun Jun 03, 2018 7:08 pm

Hi Johannes,

As requested:

  1. \documentclass[
  2. 11pt,english, onehalfspacing, nolistspacing, liststotoc, headsepline,oneside,
  3. chapterinoneline, leqno, a4paper
  4. %consistentlayout, change the layout of the declaration, abstract and acknowledgements pages to match the default layout
  5. ]{MastersDoctoralThesis}
  6.  
  7. \voffset = -2.54cm
  8. \hoffset = -2.54cm
  9. \textheight 23cm
  10. \textwidth 16 cm
  11. \topmargin 2.5cm
  12. \oddsidemargin 2.50cm \evensidemargin 2.5cm \unitlength 1cm


Best, Sean

User avatar
Johannes_B
Site Moderator
Posts: 3763
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Sun Jun 03, 2018 7:57 pm

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: 22
Joined: Sat Apr 28, 2018 9:59 pm

Postby Seanshine » Sun Jun 03, 2018 8:47 pm

Nice, enjoy the BBQ.

What interface?

This one?

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

Postby Stefan Kottwitz » Sun Jun 03, 2018 9:20 pm

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:

  1. \documentclass{article}
  2. \usepackage{amsmath}
  3. \setcounter{MaxMatrixCols}{11}
  4. \begin{document}
  5. \begin{align*}
  6. \intertext{The vector of parameters to be estimated by maximum
  7. likelihood is as follows:}
  8. \end{align*}
  9. \[
  10. \boldsymbol{\theta}_{2} = \begin{bmatrix}
  11. a_{y,1} & a_{y,2} & a_{r} & a_{0} & a_{g} & b_{\pi} & b_{y} & g
  12. & \sigma_{\Tilde{y}} & \sigma_{\pi} & \sigma_{y^{*}}
  13. \end{bmatrix}
  14. \]
  15. \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
Site admin

Seanshine
Posts: 22
Joined: Sat Apr 28, 2018 9:59 pm

Postby Seanshine » Sun Jun 03, 2018 9:30 pm

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: 8905
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Sun Jun 03, 2018 9:42 pm

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
Site admin


Return to “Math & Science”

Who is online

Users browsing this forum: No registered users and 0 guests