1

I have following problem:

\begin{figure}[htbp]
\centerline{\includegraphics[width=\columnwidth]{relations.png}}
\caption{Example of a figure caption.}
\label{fig}
\end{figure}

the image is a little bit too big if I do this above.
Instead, I'd like the width to be about 10px smaller.

I tried the following:

\begin{figure}[htbp]
\centerline{\includegraphics[width=\columnwidth - 10px]{relations.png}}
\caption{Example of a figure caption.}
\label{fig}
\end{figure}

But it doesn't work.

How can I adjust the width of the image by a few pixels?

CarLaTeX
  • 62,716

1 Answers1

1

To reduce the width of the image by 10px, you can use the "\dimexpr" command to subtract 10px from the width of the image.

Example:

\begin{figure}[htbp]
  \centerline{\includegraphics[width=\dimexpr\columnwidth-10px\relax]{relations.png}}
  \caption{Example of a figure caption.}
  \label{fig}
\end{figure}

You can also use the "\hspace*{-10px}" command to shift the image 10px to the left, which will effectively reduce the width of the image by 10px. Here is an example of how you can do this:

\begin{figure}[htbp]
  \centerline{\hspace*{-10px}\includegraphics[width=\columnwidth]{relations.png}}
  \caption{Example of a figure caption.}
  \label{fig}
\end{figure}