You should avoid spurious white space between the two minipages
. It is causing the sum of horizontal dimensions to be greater than \textwidth
:
0.5\textwidth
+ (space width) + 0.5\textwidth
> \textwidth
This spurious spaces appears by the TeX syntax itself. The right syntax demands adding a comment symbol % just at the end of the line where the first minipage
is.
By the way, remember that you can choose the horizontal alignment of minipage environment using its [pos]
optional argument. For the alignment of graphics, it is usefull the graphbox
package. It adds to \includegraphics
command the [align=t,c,b]
option.
For example, if you want your text to start at the top:
The [t]
option in minipage aligns that environment horizontally with the current line or test (even in your document, no material yet) so you must set \begin{minipage}[t]{0.5\textwidth}
in both cases.
The [align=t]
option in \includegraphics
, aligns the top of the image with the current line of text (which will be the first line of the right text)
.
At least, note that the \centering
sentence is not necessary in this example, because there is nothing to center: you are taking up the entire width of the text.
So the complete code:
\documentclass{article}
\usepackage{graphicx,graphbox}
\begin{document}
\begin{figure}[htbp]
\begin{minipage}[t]{0.5\textwidth}
\includegraphics[align=t,width=\textwidth]{your_image.jpg}%
\caption{\cite{Prochazka.2015}\label{fig:}}%
\end{minipage}%
\begin{minipage}[t]{0.5\textwidth}
Here is the text.
\end{minipage}
\end{figure}
\end{document}
\caption
out of any of theminipage
s. Also please add%
directly after the fist\end{document}
(without any spaces or newlines) to ensure proper horizontal spacing..