3

I have created minipages and I want to write a simple word AND between these two minipages without disturbing vertical and horizontal alignments. How can I make it possible?

MWE:

\documentclass[12pt]{article}
\usepackage[a4paper,top=1 in,bottom=1 in,left=0.7 in,right=0.7 in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[misc]{ifsym}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{mathtools}
\usepackage{amssymb}
\begin{document}
    \begin{minipage}[b]{.5\textwidth}
        \begin{flalign*}
        \left(x_1 , y_1\right)&=\left(\dfrac{2+2}{2}\;\;,\;\;\dfrac{4+4}{2}\right)\\[6pt]
        &=\left(2 , 4\right)
        \end{flalign*}
    \end{minipage}
    \begin{minipage}[b]{0.5\textwidth}
        \begin{flalign*}
        \left(x_2 , y_2\right)&=\left(\dfrac{4+4}{2}\;\;,\;\;\dfrac{2+2}{2}\right)\\[6pt]
        &=\left(4 , 2\right)
        \end{flalign*}
    \end{minipage}
\end{document}
  • 1
    minipages are just boxes, so write the text between them. However, if the line gets too long it will be broken, like every line. Your minipages already occupy the full \textwidth. Change the factor 0.5 e.g. to 0.4 and write and between \end{minipage} and \begin{minipage}. – gernot Oct 12 '16 at 9:59
  • you have two minipages each half a linewidth wide but they do not fit on a line as you have paragraph indentation to the left and a word space in between. Do you want them all on one line with and in between, or arranged vertically with and in the middle row? – David Carlisle Oct 12 '16 at 10:05
  • @David Carlisle Sir i wanna place AND in the middle at the top between 2 minipages – Maths4Sandy Oct 12 '16 at 10:14
  • @gernot it works but the word AND appear at the bottom. – Maths4Sandy Oct 12 '16 at 10:16
  • it is bottom aligned because you have [b] – David Carlisle Oct 12 '16 at 10:20
7

The initial markup did not fit on a line

Overfull \hbox (20.2359pt too wide) in paragraph at lines 10--22

due to extra white space added to the left and between the boxes.

Removing that white space and making the boxes smaller allows the word to fit.

I allowed the default centre alignment, you could use [t] instead of [b] but it looked a bit high

enter image description here

I would never force the two blocks this far apart it has no advantages and just makes it a lot harder for the reader to scan the page, but this is, I think, the layout that you ask for.

\documentclass[12pt]{article}
\usepackage[a4paper,top=1 in,bottom=1 in,left=0.7 in,right=0.7 in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[misc]{ifsym}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{mathtools}
\usepackage{amssymb}
\begin{document}

\noindent
    \begin{minipage}{.4\textwidth}
        \begin{flalign*}
        \left(x_1 , y_1\right)&=\left(\dfrac{2+2}{2}\;\;,\;\;\dfrac{4+4}{2}\right)\\[6pt]
        &=\left(2 , 4\right)
        \end{flalign*}
    \end{minipage}%
\hfill and\hfill
    \begin{minipage}{0.4\textwidth}
        \begin{flalign*}
        \left(x_2 , y_2\right)&=\left(\dfrac{4+4}{2}\;\;,\;\;\dfrac{2+2}{2}\right)\\[6pt]
        &=\left(4 , 2\right)
        \end{flalign*}
    \end{minipage}
\end{document}
  • Ok sir@ this work is very useful for me infact the output is nearly equal to what i want. – Maths4Sandy Oct 12 '16 at 11:04
  • in this case, wouldn't it simply be better to treat this as an unnumbered equation, and use a couple of {aligned}[t] blocks with \text{and} in the middle, so that it would be base-aligned? – barbara beeton Oct 12 '16 at 14:52
  • @barbarabeeton something like that yes, that would give more reasonable spacing not splat it all out full width. – David Carlisle Oct 12 '16 at 15:01
1

You can simple put another minipage. Generally you can use as much minipage as you want. You can align it as you want inside this minipage by changing the number inside \vspace{}. For example see below:

\documentclass[12pt]{article}
\usepackage[a4paper,top=1 in,bottom=1 in,left=0.7 in,right=0.7 in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[misc]{ifsym}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{mathtools}
\usepackage{amssymb}
\begin{document}
    \begin{minipage}[b]{.42\textwidth}
        \begin{flalign*}
        \left(x_1 , y_1\right)&=\left(\dfrac{2+2}{2}\;\;,\;\;\dfrac{4+4}{2}\right)\\[6pt]
        &=\left(2 , 4\right)
        \end{flalign*}
    \end{minipage}
    \begin{minipage}[t]{.06\textwidth}
    \vspace{-10mm}and
    \end{minipage}
    \begin{minipage}[b]{0.42\textwidth}
        \begin{flalign*}
        \left(x_2 , y_2\right)&=\left(\dfrac{4+4}{2}\;\;,\;\;\dfrac{2+2}{2}\right)\\[6pt]
        &=\left(4 , 2\right)
        \end{flalign*}
    \end{minipage}
\end{document}
  • It works but how can move that word verically, i mean move it above – Maths4Sandy Oct 12 '16 at 10:21
  • 3
    this line is now even more overfull than the original (47.7pt) it has 1.05\textwidth frmm the minipages, a \parindent of 15pt and two word spaces – David Carlisle Oct 12 '16 at 10:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.