I am having some trouble in centering images in lyx and have read a number of questions on the topic. However, when attempting to apply the solutions from the answers the images are still not centered. The code in lyx is:
\begin{figure}
\includegraphics[scale=0.4]{Figure5_RPC_Problem_1}\caption{Wider than figure text. Wider than figure text.}
\end{figure}
I tried using the centering commands:
\centering\includegraphics{...}
when the figure is smaller than the text width\centerline{\includegraphics{...}}
when the figure is wider than the text width
\begin{figure}
\centering\includegraphics[scale=0.4]{Figure5_RPC_Problem_1}\caption{Wider than figure text. Wider than figure text. Wider than figure text.Wider than figure text.Wider than figure text.}
\end{figure}
and
\begin{figure}
\centerline{\includegraphics[scale=0.4]{Figure5_RPC_Problem_1}\caption{Wider than figure text. Wider than figure text.Wider than figure text.Wider than figure text.Wider than figure text.}}
\end{figure}
but the output is still the same. Next I tried using the center environment but the image is still not centered
\begin{center}
\begin{figure}
\centerline{\includegraphics[scale=0.4]{Figure5_RPC_Problem_1}\caption{Wider than figure text. Wider than figure text.Wider than figure text.Wider than figure text.Wider than figure text.}}
\end{figure}
\end{center}
The document now looks like:
A link to the image can be found here.
Edit:
I have modified the code to:
\begin{figure}
\centering\includegraphics[scale=0.4]{Figure5_RPC_Problem_1}\caption{Wider than figure text. Wider than figure text.Wider than figure text.Wider than figure text.Wider than figure text.Wider than figure text.Wider than figure text.Wider than figure text.Wider than figure text.Wider than figure text.Wider than figure text.Wider than figure text.Wider than figure text.}
\end{figure}
but the image is still placed slightly to the right.
\begin{figure}\centering\includegraphics...\end{figure}
. You can use\fbox{\includegraphics...}
in order to see the real dimensions of your image. Maybe you are having some white space on one side.Figure5_RPC_Problem_1
in an image viewer and check, crop if needed. Sidenote: Asfigure
is a floating environment (i.e. it can move), it doesn't make sense to have it inside acenter
environment. Most likely it will simply float away and leave you with unwanted vertical space in the text.example-image
fromincludegraphix
package:\includegraphics[scale=0.4]{Figure5_RPC_Problem_1}\caption{Wider than figure text. Wider than figure text.Wider than figure text.}
If it is centered (there is no reason to not be) than read above comments again!