0

I would like to obtain the result shown in the image below. There is no problem with the text nor with the picture. I use enumerate and tikzpicture environment for them. The PROBLEM is I don't know how to place the picture alongside the text.

For explanation purposes, there is no need to replicate text or the picture, use any simple list and tikzpicture. Any help will be appreciated.

enter image description here

Edit

\documentclass[a4paper,11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{setspace,parskip}
\usepackage{tikz}
\usepackage{amsmath,amsfonts,amssymb,amsthm,systeme,siunitx}
\usepackage[paper=a4paper,hmargin={2.5cm,2.5cm},vmargin={2.5cm},headsep={0.5cm}]{geometry}
\usepackage{xcolor}
\usepackage{paracol}

\begin{document}
\columnratio{0.75}
\onehalfspacing

\begin{enumerate}
    \item blah blah blah item 1
\begin{paracol}{2}
   \begin{leftcolumn}
      \item Un recipiente contiene agua y aceite. Calcule:
      \begin{enumerate}
        \item El ángulo de refracción de un rayo de luz que, procedente del fondo del recipiente, incide en la capa de aceite con un ángulo de \ang{40}.
        \item El ángulo de incidencia de un rayo de luz para que, incidiendo desde el aceite hacia el agua, se produzca la reflexión total.
        \item Las frecuencias del haz de luz en el agua y en el aceite, si su longitud de onda es de 450 nm.
    \end{enumerate}
    \emph{Datos}: $n_{agua}=1,33$, $n_{acaite}=1.45$, $c=3\cdot10^{8}$ \unit{m.s^{-1}}
   \end{leftcolumn}
   \begin{rightcolumn}
      \begin{tikzpicture}
    \draw[yellow!30,fill=yellow!10] (0,2) rectangle (3,1);
    \draw[cyan!30,fill=cyan!10] (0,1) rectangle (3,0);
    \draw[very thick] (0,2.3) -- (0,0) -- (3,0) -- (3,2.3);
    \node at (1.5,1.5) {aceite};
    \node at (1.5,0.5) {agua};
    \end{tikzpicture}
   \end{rightcolumn}
\end{paracol}
\item blah blah blah item 3
\end{enumerate}
\end{document}

Now the idea is to place the image at medium height, not at the top.

1 Answer 1

0

There might be better solutions, but I usually use paracol in such cases:

\usepackage{paracol}

\begin{document}
\columnratio{0.7} % 0,7 of the widths for the text, rest for the image
\begin{paracol}{2}
   \begin{leftcolumn}
      text, list, stuff
   \end{leftcolumn}
   \begin{rightcolumn}
      \vspace*{-1.5em}
      image
   \end{rightcolumn}
\end{paracol}
\end{document}

edit: Added the code in question to have the desired spacing:

\documentclass[a4paper,11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{setspace,parskip}
\usepackage{tikz}
\usepackage{amsmath,amsfonts,amssymb,amsthm,systeme,siunitx}
\usepackage[paper=a4paper,hmargin={2.5cm,2.5cm},vmargin={2.5cm},headsep={0.5cm}]{geometry}
\usepackage{xcolor}
\usepackage{paracol}

\begin{document}
    \columnratio{0.75}
    \setlength\columnsep{0pt}
    \onehalfspacing
    
    \begin{enumerate}
        \item blah blah blah item 1
        \begin{paracol}{2}
            \begin{leftcolumn}
                \item Un recipiente contiene agua y aceite. Calcule:
                \begin{enumerate}
                    \item El ángulo de refracción de un rayo de luz que, procedente del fondo del recipiente, incide en la capa de aceite con un ángulo de \ang{40}.
                    \item El ángulo de incidencia de un rayo de luz para que, incidiendo desde el aceite hacia el agua, se produzca la reflexión total.
                    \item Las frecuencias del haz de luz en el agua y en el aceite, si su longitud de onda es de 450 nm.
                \end{enumerate}
                \emph{Datos}: $n_{agua}=1,33$, $n_{acaite}=1.45$, $c=3\cdot10^{8}$ \unit{m.s^{-1}}
            \end{leftcolumn}
            \begin{rightcolumn}
                \vspace*{1cm}\hspace*{-20pt}
                \begin{tikzpicture}
                    \draw[yellow!30,fill=yellow!10] (0,2) rectangle (3,1);
                    \draw[cyan!30,fill=cyan!10] (0,1) rectangle (3,0);
                    \draw[very thick] (0,2.3) -- (0,0) -- (3,0) -- (3,2.3);
                    \node at (1.5,1.5) {aceite};
                    \node at (1.5,0.5) {agua};
                \end{tikzpicture}
            \end{rightcolumn}
        \end{paracol}
        \item blah blah blah item 3
    \end{enumerate}
\end{document}

Here is how it looks like for me:

enter image description here

16
  • Ok, thank you. That is one step forward. But why the image does appear at the top of it column? Is there a positioning option? Apr 13, 2023 at 0:58
  • It should, actually, can you post your code which displays the problem?
    – Photon
    Apr 13, 2023 at 4:46
  • Well, there is the code. Apr 14, 2023 at 0:37
  • Not sure why this is happening, but you can shift the image up with a \vspace*{-1.5em}, I edited the code accordingly.
    – Photon
    Apr 14, 2023 at 7:27
  • Sorry, I misread your comment, you actually don't want it to appear at the top. Then you need a positive vspace.
    – Photon
    Apr 14, 2023 at 7:31

You must log in to answer this question.

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