0

i have a main.Tex file. In main there are text subfiles.

\subfile{Pregunta1.tex}
\subfile{Pregunta2.tex} 
\subfile{Pregunta3.tex}
\subfile{Pregunta4.tex}

I want to put an image surrounded by text in the subfiles. The issue is, there is written this in subfile Pregunta2.tex:

...se puede hacer conectándolo a la simulación; esto se denomina \textit{Hardware-in-the-loop} (\textbf{HIL}).\begin{wrapfigure}{r}{.3\textwidth}
  \centering
    \includegraphics[width=.27\textwidth]{images/RTHIL.jpg}
  \caption{This is the image.}
\end{wrapfigure}

\textbf{Las simulaciones eléctricas en tiempo real con HIL tienen muchas ventajas.} Una de ellas es que, para... 

When i press recompile (in overleaf) with subfile open everything is ok (but only compiles that subfile). enter image description here But trying to recompile from the main open (so it shows all the document), happens that the image is behind the text. enter image description here

I am using overleaf.

if someone can help me, would appreciate that. Sorry about my grammar, hope could be understood.

Best regards

3
  • 2
    presumbly the code following the wrapfig that you have not shown is preventing wrapping, please show a small complete example Jun 19, 2023 at 21:00
  • Please try to give us an MWE (Minimal Working Example) we can copy-paste-compile to reproduce the problem. We can't do that with just fragments, so all anybody can do is try to guess.
    – cfr
    Jun 20, 2023 at 3:18
  • you have changed the question to be about subfile. you still have provided no example sorry impossible to guess unless you show an example. compare with my answer which has two complete examples Jun 20, 2023 at 6:21

1 Answer 1

1

You provided no example but I guess you have

enter image description here

\documentclass{article}

\usepackage{wrapfig}
\usepackage{graphicx}

\begin{document}



\begin{wrapfigure}{r}{.3\textwidth}
  \centering
    \includegraphics[width=.27\textwidth]{example-image}
  \caption{This is the image.}
\end{wrapfigure}
{\bfseries Bold text bold text} normal text normal text normal text
 normal text normal text normal text normal text normal text normal text
 normal text normal text normal text normal text normal text normal text
 normal text normal text normal text normal text normal text normal text
 normal text normal text normal text normal text normal text normal text
 normal text normal text normal text normal text normal text normal text.

\end{document}

You can not start the text inside a group, \textbf starts the paragraph earlier:

enter image description here

\documentclass{article}

\usepackage{wrapfig}
\usepackage{graphicx}

\begin{document}



\begin{wrapfigure}{r}{.3\textwidth}
  \centering
    \includegraphics[width=.27\textwidth]{example-image}
  \caption{This is the image.}
\end{wrapfigure}
\textbf{Bold text bold text} normal text normal text normal text
 normal text normal text normal text normal text normal text normal text
 normal text normal text normal text normal text normal text normal text
 normal text normal text normal text normal text normal text normal text
 normal text normal text normal text normal text normal text normal text
 normal text normal text normal text normal text normal text normal text.

\end{document}
1
  • Thanks, i provided more information to the question. If you can have a look on that again would be great. Thank u for your time Jun 20, 2023 at 1:34

You must log in to answer this question.

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