5

How do I get the usual inter-line spacing after "Calculation of the edge length of the octagon" and the contents of the minipage environment? I know how to put the contents of a minipage environment to the left of a TikZ diagram, but I do not insist on using a minipage environment.

\documentclass[10pt]{amsart}
\usepackage{mathtools}

\begin{document}
\noindent \textbf{Calculation of the edge length of the octagon} \\
\noindent \begin{minipage}[t]{4.5in}
\vskip0pt
\noindent \raggedright{The sum of the measures of (interior) angles in the octagon \\
is $(8 - 2)180^{\circ} = 1080^{\circ}$, and so, the measure of the (interior)  \\
angles is $135^{\circ}$. The angles that are supplementary to the \\
(interior) angles of the octagon all have the same measure \\
--- $45^{\circ}$. So, the four right triangles at the corners of the \\
square are isosceles right triangles. If $x$ is the edge length \\
of the octagon,}
\end{minipage}
%
\hspace{-0.25cm}
%
\begin{tikzpicture}[baseline=(current bounding box.north)]

%A regular octagon is drawn.
\draw (0,{3/2-(3/2)*(sqrt(2)-1)}) coordinate (A) -- (0,{3/2+(3/2)*(sqrt(2)-1)}) coordinate (B)
-- ({3/2-(3/2)*(sqrt(2)-1)},3) coordinate (C) -- ({3/2+(3/2)*(sqrt(2)-1)},3) coordinate (D)
--  (3,{3/2+(3/2)*(sqrt(2)-1)}) coordinate (E) -- (3,{3/2-(3/2)*(sqrt(2)-1)}) coordinate (F)
-- ({3/2+(3/2)*(sqrt(2)-1)},0) coordinate (G) -- ({3/2-(3/2)*(sqrt(2)-1)},0) coordinate (H)
-- cycle;

%The vertices of the octagon are typeset.
\node[font=\footnotesize, anchor=east, inner sep=0] at ($(0,{3/2-(3/2)*(sqrt(2)-1)}) +(-0.15,0)$){$A$};
\node[font=\footnotesize, anchor=east, inner sep=0] at ($(0,{3/2+(3/2)*(sqrt(2)-1)}) +(-0.15,0)$){$B$};
\node[font=\footnotesize, anchor=south,inner sep=0] at ($({3/2-(3/2)*(sqrt(2)-1)},3) +(0,0.15)$){$C$};
\node[font=\footnotesize, anchor=south,inner sep=0] at ($({3/2+(3/2)*(sqrt(2)-1)},3) +(0,0.15)$){$D$};
\node[font=\footnotesize, anchor=west,inner sep=0] at ($(3,{3/2+(3/2)*(sqrt(2)-1)}) +(0.15,0)$){$E$};
\node[font=\footnotesize, anchor=west,inner sep=0] at ($(3,{3/2-(3/2)*(sqrt(2)-1)}) +(0.15,0)$){$F$};
\node[font=\footnotesize, anchor=north, inner sep=0] at ($({3/2+(3/2)*(sqrt(2)-1)},0) +(0,-0.15)$){$G$};
\node[font=\footnotesize, anchor=north, inner sep=0] at ($({3/2-(3/2)*(sqrt(2)-1)},0) +(0,-0.15)$){$H$};


%A triangle is inscribed in the octagon.
\draw[dashed] (A) -- (F);
\draw[dashed] (A) -- (C);
\draw[dashed] (C) -- (F);

\node[anchor=north, inner sep=0, font=small, font=\scriptsize] at ($($(A)!0.5!(F)$) +(0,-0.15)$){8};

\end{tikzpicture}
\end{document}
2
  • 2
    Remove all \\ , \raggedright, \vskip as well as the third \noindent, and add an empty line before \begin{minipage}. Then describe what should be different.
    – gernot
    Sep 27, 2016 at 17:55
  • 2
    You're also using \raggedright wrong, it should be {\raggedright ...} not \raggedright{...}. But if everything inside the minipage should be raggedright, then you don't need the braces at all, the setting will be local to the minipage. Sep 27, 2016 at 18:01

2 Answers 2

3

minipages (and \parboxes) are known to have issues with baseline skips. It's easy enough to avoid them in order to obtain what you want (marked B below). If you must use a minipage, then consider adding some \struts without the vertical skips (marked C below). A is the original input provided, while the last set of comparisons shows the similarities between B and C.

enter image description here

\documentclass{article}

\usepackage[margin=1in,landscape]{geometry}

\begin{document}


\noindent
\begin{minipage}[t]{.45\textwidth}
\noindent \textbf{A: Calculation of the edge length of the octagon} \\
\noindent \begin{minipage}[t]{4.5in}
\vskip0pt
\noindent \raggedright{The sum of the measures of (interior) angles in the octagon \\
is $(8 - 2)180^{\circ} = 1080^{\circ}$, and so, the measure of the (interior)  \\
angles is $135^{\circ}$. The angles that are supplementary to the \\
(interior) angles of the octagon all have the same measure \\
--- $45^{\circ}$. So, the four right triangles at the corners of the \\
square are isosceles right triangles. If $x$ is the edge length \\
of the octagon,}
\end{minipage}
\end{minipage}
\hfill
\begin{minipage}[t]{.45\textwidth}
\noindent\textbf{B: Calculation of the edge length of the octagon}

\noindent\raggedright The sum of the measures of (interior) angles in the octagon
is $(8 - 2)180^{\circ} = 1080^{\circ}$, and so, the measure of the (interior)
angles is $135^{\circ}$. The angles that are supplementary to the
(interior) angles of the octagon all have the same measure
--- $45^{\circ}$. So, the four right triangles at the corners of the
square are isosceles right triangles. If~$x$ is the edge length
of the octagon,
\end{minipage}

\bigskip

\noindent
\begin{minipage}[t]{.45\textwidth}
\noindent \textbf{A: Calculation of the edge length of the octagon} \\
\noindent \begin{minipage}[t]{4.5in}
\vskip0pt
\noindent \raggedright{The sum of the measures of (interior) angles in the octagon \\
is $(8 - 2)180^{\circ} = 1080^{\circ}$, and so, the measure of the (interior)  \\
angles is $135^{\circ}$. The angles that are supplementary to the \\
(interior) angles of the octagon all have the same measure \\
--- $45^{\circ}$. So, the four right triangles at the corners of the \\
square are isosceles right triangles. If $x$ is the edge length \\
of the octagon,}
\end{minipage}
\end{minipage}
\hfill
\begin{minipage}[t]{.45\textwidth}
\noindent\strut\textbf{C: Calculation of the edge length of the octagon}

\begin{minipage}[t]{4.5in}
\noindent\strut\raggedright The sum of the measures of (interior) angles in the octagon
is $(8 - 2)180^{\circ} = 1080^{\circ}$, and so, the measure of the (interior)
angles is $135^{\circ}$. The angles that are supplementary to the
(interior) angles of the octagon all have the same measure
--- $45^{\circ}$. So, the four right triangles at the corners of the
square are isosceles right triangles. If~$x$ is the edge length
of the octagon,
\end{minipage}
\end{minipage}

\bigskip

\noindent
\begin{minipage}[t]{.45\textwidth}
\noindent\textbf{B: Calculation of the edge length of the octagon}

\noindent\raggedright The sum of the measures of (interior) angles in the octagon
is $(8 - 2)180^{\circ} = 1080^{\circ}$, and so, the measure of the (interior)
angles is $135^{\circ}$. The angles that are supplementary to the
(interior) angles of the octagon all have the same measure
--- $45^{\circ}$. So, the four right triangles at the corners of the
square are isosceles right triangles. If~$x$ is the edge length
of the octagon,
\end{minipage}
\hfill
\begin{minipage}[t]{.45\textwidth}
\noindent\strut\textbf{C: Calculation of the edge length of the octagon}

\begin{minipage}[t]{4.5in}
\noindent\strut\raggedright The sum of the measures of (interior) angles in the octagon
is $(8 - 2)180^{\circ} = 1080^{\circ}$, and so, the measure of the (interior)
angles is $135^{\circ}$. The angles that are supplementary to the
(interior) angles of the octagon all have the same measure
--- $45^{\circ}$. So, the four right triangles at the corners of the
square are isosceles right triangles. If~$x$ is the edge length
of the octagon,
\end{minipage}
\end{minipage}

\end{document}

A drawback of using minipages is that it doesn't break across the page boundary since the content is boxed.

1
  • I edited my post to include the reason for using a minipage. I do not insist on having a minipage environment.
    – Adelyn
    Oct 1, 2016 at 0:32
3

Putting vertical space inside a minipage, at the top, causes LaTeX to place the very top of the minipage on the baseline of the current line. Omitting that vertical space lets LaTeX place the baseline of the first line of the minipage contents on the baseline. So lose that \vskip 0pt and LaTeX should do what you want.

If you also need the top of the first line of text to align with the top of the figure, then you can put that figure in a minipage and adjust the top of that figure:

\begin{minipage}[t]{2in}
\setbox0=\hbox{T} % tallest letter of the first line of other minipage
\vskip-\ht0
\begin{tikzpicture}[baseline=(current bounding box.north)]
...
\end{tikzpicture}
\end{minipage}
3
  • I edited the code to include an explanation for using a minipage environment and using \vskip0pt.
    – Adelyn
    Oct 1, 2016 at 0:37
  • @Adelyn: I've added to my answer.
    – Dan
    Oct 5, 2016 at 20:04
  • Sorry for not replying. I will look at your code later.
    – Adelyn
    Oct 26, 2016 at 14:55

You must log in to answer this question.

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