TransWikia.com

Minipage is not working properly

TeX - LaTeX Asked on March 17, 2021

I am trying to draw a figure on the right and some text on the left (I have defined a lemma environment in my preamble, it is working everywhere in my code). This is my code:

There are some other formulae for inradius which requires the following lemma, which gives the distances of the points of contact of incircle and sides from the vertices.
begin{mdframed}[backgroundcolor = gray!20]
begin{minipage}{0.5textwidth}
noindent
begin{lemma}
In $Delta ABC$ let $D,E$, and $F$ be the points of contact of incircle with the sides $BC,CA$ and $AB$ respectively as shown in figure, then we have
begin{equation}
left.
begin{array}{ccc}
AE  & = & AF=s-a 
BD  & =  & BF= s-b
 CD  & =  & CE=  s-c   
end{array}
right}
label{101020eq02}
end{equation}
end{lemma}
end{minipage}
begin{minipage}{0.5textwidth}
begin{figure}
centering
includegraphics{SoTFig16.pdf}
end{figure}
end{minipage}
end{mdframed}

This code is throwing an error Not in outer par mode. How can I remove the error? Is there an better way to get the desired output? I tried wrapfigure too but it did not work.

Thanks!

One Answer

Figures are "floating objects" (meant to migrate to a different place on the page or on subsequent pages) and can't be put in a minipage. Since there is no caption, you probably don't want a "figure", but just includegraphics.

You also have an error with two minipages of 0.5textwidth, with no allowance for the space between them.

documentclass{article}
usepackage{mdframed,amsmath,amsthm,graphicx,xcolor}
newtheorem{lemma}{Lemma}
begin{document}
Figures are ``floating objects'' and can't be put in a minipage. 
Since there is no caption, you probably don't want a ``figure'' 
but just verb|includegraphics|.
begin{mdframed}[backgroundcolor = gray!20]
begin{minipage}{0.48textwidth}
begin{lemma}
In $Delta ABC$ let $D,E$, and $F$ be the points of contact of in circle
with the sides $BC,CA$ and $AB$ respectively as shown in figure, then we have
begin{equation}
left.
begin{array}{ccc}
AE  & = & AF=s-a 
BD  & =  & BF= s-b
 CD  & =  & CE=  s-c   
end{array}
right}
label{101020eq02}
end{equation}
end{lemma}
end{minipage}hfill
begin{minipage}{0.47textwidth}
centering
includegraphics{example-image-b.pdf}
end{minipage}
end{mdframed}
end{document}

Why did you tag "wrapfigure"? was it just to get me to read the question? You could probably use it, but there is no benefit in this example.

Answered by Donald Arseneau on March 17, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP