10

Is it possible to change the default width of an image included via \includegraphics (from the graphicx package) to a custom value, for example \linewidth.

So I want something like this:

\documentclass{article}

\usepackage[draft,width=\linewidth]{graphicx}

%or something like \setglobalimagewidth=\linewidth

\begin{document}

\includegraphics{test1} %width=\linewidth
\includegraphics[width=4cm]{test1} %width=4cm


\end{document}
1
  • Another example, were this makes perfectly sense is the use of vector graphics, which do not suffer from scaling.
    – luator
    Apr 2, 2015 at 12:31

2 Answers 2

15

Some options of package graphicx can be set using \setkeys:

\documentclass{article}
\usepackage{graphicx}
\setkeys{Gin}{width=\linewidth}

\begin{document}
  \noindent
  \includegraphics{test1}
\end{document}

What is Gin ? Documentation:

Here ‘Gin’ is the name used for the keyval keys associated with ‘Graphics inclusion`.

1
1

I do not think that I have the perfect solution but I am happy with:

% Define new length
\newlength{\myFigureStandardWidth}
% Set the new length to a specific value
\setlength{\myFigureStandardWidth}{0.90\textwidth}

When I insert a figure then I just use something like

\begin{figure}
\centering
    \includegraphics[width=\myFigureStandardWidth]%
    {FigureName.png}%
\caption[Short Caption]{Long Caption}
\label{fig:FigureName}
\end{figure}

I am writing my phd thesis this way and have inserted over 50 figures this way.

You must log in to answer this question.

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