Latex help needed, about text between 2 images

In summary, the user is having trouble placing text between two images in their LaTeX document. They have tried various solutions found online, but none have worked. The user has also noticed that adding more text prior to the images seems to "fix" the issue, but this is not a reliable solution. The expert suggests making the entire section one big "figure" and using a long descriptive caption to describe all three images. They also suggest using the optional argument in the caption to fix any issues with the list of figures.
  • #1
fluidistic
Gold Member
3,948
264
Latex "help" needed, about text between 2 images

I'm having troubles to place a text between 2 images.
The code looks like this:

Code:
\begin{figure}[ht]
\begin{minipage}[b]{0.45\linewidth}
\centering
\includegraphics[width=\textwidth]{vvalue}
\caption{value1}
\label{test1}
\end{minipage}
\hspace{0.0cm}
\begin{minipage}[b]{0.45\linewidth}
\centering
\includegraphics[width=\textwidth]{wvalue}
\caption{value2}
\label{test2}
\end{minipage}
\end{figure}

Some text here.

\centerline{\includegraphics[scale=0.36, resolution=900]{test126}}

What is displayed is: "Some text here", then the first image and then the last image. I would like the "Some text here" to be placed in between the two images.

I have tried google and some suggestions, such as using \usepackage{float} and adding an "[H]" at the end of the \centerline line.
Also tried \par \bigskip in between the two images. No luck so far.
 
Physics news on Phys.org
  • #2
Problem "fixed".
I added more text prior to this part of the document in such a way that now the images and the text are displayed in the middle of a page. The text is now "magically" displayed between the 2 images...
 
  • #3
fluidistic said:
Problem "fixed".
I added more text prior to this part of the document in such a way that now the images and the text are displayed in the middle of a page. The text is now "magically" displayed between the 2 images...
That's not a good fix. Add more text elsewhere and the problem will reappear. Your first figure is a figure: It's a float. It goes where LaTeX thinks it should go. Your second figure is not a figure. It's just part of the document. It goes where you put it.

Aside: It looks like you are using cargo cult techniques with your LaTeX. Why do you have two captions for that figure environment?

There are a number of ways to "fix" this problem. I'd suggest making the whole enchilada one big "figure". Make a long descriptive caption that describes all three images that comprise the figure. It's common to have very long captions. This might create a new problem if you have a list of figures in your front matter. That long, descriptive caption looks out of place in the list of figures. Use the optional argument to caption to fix this new problem:

\caption[Short title]{Short title. Detailed description of what's shown …}\label{fig:fig42}
 

FAQ: Latex help needed, about text between 2 images

1. What is Latex and why is it used?

Latex is a typesetting language used for creating high-quality documents, particularly in the fields of mathematics, science, and technical writing. It is preferred over traditional word processors because of its advanced typesetting capabilities and its ability to handle complex mathematical equations and symbols.

2. How do I add text between two images in Latex?

To add text between two images in Latex, you can use the \begin{figure} and \end{figure} commands. Within these commands, you can use the \includegraphics{} command to insert your images and the \caption{} command to add a caption. You can place your text in between these commands to have it appear between the two images.

3. Can I customize the placement of the text between the images?

Yes, you can customize the placement of the text between the images by using the \hspace{} command to add horizontal space and the \vspace{} command to add vertical space. You can also use the \centering command to center the text between the images.

4. How do I add a title and reference for the figures?

To add a title and reference for the figures, you can use the \caption{} command within the \begin{figure} and \end{figure} commands. The title will appear below the figure and the reference will be automatically numbered and added to your list of figures.

5. Can I add a border or frame around the images and text?

Yes, you can add a border or frame around the images and text by using the \fbox{} command. This will create a frame around the content within the command. You can also customize the thickness and color of the frame using additional commands within the \fbox{} command.

Similar threads

Replies
5
Views
3K
Replies
4
Views
5K
Replies
5
Views
2K
Replies
5
Views
4K
Replies
4
Views
2K
Replies
7
Views
3K
Replies
4
Views
3K
Replies
1
Views
2K
Back
Top