Generaltext on left and graphics(Fig.) image on the right

LaTeX specific issues not fitting into one of the other forums of this category.
metric
Posts: 61
Joined: Mon Mar 24, 2008 8:34 am

text on left and graphics(Fig.) image on the right

Post by metric »

Hi,

I use latex to prepare question papers for my class, for geometry i used jpg files (for geometric figs) and then give there path in latex.

The image comes below the question, i always try to get them to the right side of question on the same line, but am unable to do so, can any one show me how to do that.

IT show look some thing like this

show that triangel ABC cong. triangel PQR,
Given that AB is cong. to PQ,~~~~~~~~~~~~~~~~~~~~~~~~Fig. of the questn. should
BC is cong. to QR.~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~be here.
angle B is cong. to angle Q



~ in above text means blank space


Pls. help how can i do this, Pls. I use mitex for windows.


Thanks,
Metric.

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

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

text on left and graphics(Fig.) image on the right

Post by localghost »

You could use the wrapfig package that makes text wrapping the figure automatically.

Code: Select all

\documentclass[BCOR13mm,DIV15]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[english]{babel}
\usepackage[font=small,labelfont=bf]{caption}
\usepackage{blindtext}

\parindent0pt

\begin{document}
  \blindtext

  \medskip
  \begin{wrapfigure}{r}{7cm}
    \centering
    \rule{6.4cm}{3.6cm}
    \caption{Dummy figure}\label{fig:dummy}
  \end{wrapfigure}
  \blindtext

  \medskip
  \blindtext
\end{document}
The used document class and packages should be well-known. Descriptions and documentations are available on CTAN.


Best regards
Thorsten¹
metric
Posts: 61
Joined: Mon Mar 24, 2008 8:34 am

Re: text on left and graphics(Fig.) image on the right

Post by metric »

Hi,

Thanks for the info., i used the wrap command and was able to get the desired result, however when i used it along with enumerate command and used \item command. am unable to get the desired output.

Pls. assit , in short am unable to use wrapfigure command along with \item command, Pls. can you let me know how to do that.

Thank you,

metrics
User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

text on left and graphics(Fig.) image on the right

Post by Juanjo »

Use two parallel minipages:

Code: Select all

\documentclass{article}
% To get the \captionof command, load
% capt-of or caption
\usepackage{caption}
%\usepackage{capt-of}

\begin{document}

\noindent
\begin{minipage}{0.45\linewidth}
  Here we have a list:
   \begin{enumerate}
      \item One
      \item Two
      \item Three
   \end{enumerate}
\end{minipage}%
\hfill
\begin{minipage}{0.45\linewidth}
  \centering
  \rule{0.9\linewidth}{0.5\linewidth}
  \captionof{figure}{Dummy figure}\label{fig:f1}
\end{minipage}

\bigskip \bigskip

\noindent
\begin{minipage}[t]{0.45\linewidth}
  \vspace{0pt}
   Here we have a list:
   \begin{enumerate}
      \item One
      \item Two
      \item Three
   \end{enumerate}
\end{minipage}%
\hfill
\begin{minipage}[t]{0.45\linewidth}
  \vspace{0pt}
  \centering
  \rule{0.9\linewidth}{0.5\linewidth}
  \captionof{figure}{Dummy figure}\label{fig:f2}
\end{minipage}

\end{document}
The precise alignment of the minipages depends on their contents.
balf
Posts: 158
Joined: Sat Jan 12, 2008 1:11 am

Re: text on left and graphics(Fig.) image on the right

Post by balf »

You also can input the (plain tex) package insbox, which hasn't the same limitations as wrapfig and is very simple to use.

B.A.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

text on left and graphics(Fig.) image on the right

Post by localghost »

I did some experiments with invisible characters and negative vertical spaces. But I ran into trouble.

Code: Select all

\documentclass[BCOR13mm,DIV15]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[english]{babel}
\usepackage[font=small,labelfont=bf]{caption}

\parindent0pt

\begin{document}
  \begin{wrapfigure}[10]{r}{7cm}
    \centering
    \rule{6.4cm}{3.6cm}
    \caption{Dummy figure}\label{fig:dummy}
  \end{wrapfigure}
  ~
  \vspace{-\baselineskip}
  \begin{enumerate}
    \item The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
    \item The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
    \item The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
    \item The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
    \item The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
    \item The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
    \item The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
    \item The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
  \end{enumerate}
\end{document}
The result is the same as if using the approach given by Juanjo with two minipage environments side by side. The figure is not wrapped by the text.

As additional alternatives to that given by balf I suggest the floatflt package or the picins package.
balf
Posts: 158
Joined: Sat Jan 12, 2008 1:11 am

Re: text on left and graphics(Fig.) image on the right

Post by balf »

As far as I know, floatflt and picins have problems in the neighbourhood of a list environment, which shouldn't be the case with insbox, as it is a plain TeX package.

B.A.
metric
Posts: 61
Joined: Mon Mar 24, 2008 8:34 am

text on left and graphics(Fig.) image on the right

Post by metric »

Juanjo wrote:Use two parallel minipages:

Code: Select all

\documentclass{article}
% To get the \captionof command, load
% capt-of or caption
\usepackage{caption}
%\usepackage{capt-of}

\begin{document}

\noindent
\begin{minipage}{0.45\linewidth}
  Here we have a list:
   \begin{enumerate}
      \item One
      \item Two
      \item Three
   \end{enumerate}
\end{minipage}%
\hfill
\begin{minipage}{0.45\linewidth}
  \centering
  \rule{0.9\linewidth}{0.5\linewidth}
  \captionof{figure}{Dummy figure}\label{fig:f1}
\end{minipage}

\bigskip \bigskip

\noindent
\begin{minipage}[t]{0.45\linewidth}
  \vspace{0pt}
   Here we have a list:
   \begin{enumerate}
      \item One
      \item Two
      \item Three
   \end{enumerate}
\end{minipage}%
\hfill
\begin{minipage}[t]{0.45\linewidth}
  \vspace{0pt}
  \centering
  \rule{0.9\linewidth}{0.5\linewidth}
  \captionof{figure}{Dummy figure}\label{fig:f2}
\end{minipage}

\end{document}
The precise alignment of the minipages depends on their contents.
Sorry, am unable to get the result i want, below is a sample of the output result i would like to get but am unable to do so even after exprimenting with above code, pls. assist ...

1) prove that triangle ABC is cong to trian PQR
Given : some given conditions ..... ~~~~~~~~~~~~~~~
............................~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~Fig. for question 1)
.........................

2) prove that some of the measure of a triangle
is 180 degree~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Fig. for Q2)

3) Prove that sum of the measure of 2 angles in a
triangle is greater than or equal to 3rd angle~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Fig for Q. 3
metric
Posts: 61
Joined: Mon Mar 24, 2008 8:34 am

text on left and graphics(Fig.) image on the right

Post by metric »

Sorry, am unable to get the result i want, below is a sample of the output result i would like to get but am unable to do so even after exprimenting with above code, pls. assist ...


1) prove that triangle ABC is cong to trian PQR
Given : some given conditions ..... ~~~~~~~~~~~~~~~
............................~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~Fig. for question 1)
.........................

2) prove that some of the measure of a triangle
is 180 degree~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Fig. for Q2)

3) Prove that sum of the measure of 2 angles in a
triangle is greater than or equal to 3rd angle~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Fig for Q. 3


Thanks for devoting the time, i really want to get the output as listed above, thanks for the efforts put in by the forum members.

Pls. help me in letting me knew on how to get the output,

Thanks,
metric
User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

text on left and graphics(Fig.) image on the right

Post by Juanjo »

Does the following code fit your needs now?

Code: Select all

\documentclass{article}
\usepackage{graphicx}
\usepackage[font=small]{caption}

\begin{document}

\begin{enumerate}

\item 
   \begin{minipage}[t]{0.45\linewidth}
      Prove that triangle $ABC$ is congruent to triangle $PQR$.
      Given these conditions blah blah blah.
   \end{minipage}%
   \hfill
   \begin{minipage}[t]{0.45\linewidth}
     \centering
     \vspace{-1.5ex}
     \rule{0.9\linewidth}{0.5\linewidth} %
     \captionof{figure}{See triangles $ABC$ and $PQR$}\label{fig:f1}
   \end{minipage}

\item 
   \begin{minipage}[t]{0.45\linewidth}
      Prove this and that. Try this and that blah blah blah.
   \end{minipage}%
   \hfill
   \begin{minipage}[t]{0.45\linewidth}
     \centering
     \vspace{-1.5ex}
     \rule{0.9\linewidth}{0.5\linewidth}
     \captionof{figure}{This picture exemplifies blah blah}\label{fig:f2}
   \end{minipage}
   
\end{enumerate}

\end{document}
Let's remark that I use the same basic idea as in my previous post. Now there are two parallel minipages in each list entry.
Post Reply