1

I want to scale an image in my document to the whole pagewidth. I googled on how to do it and people were recommending the use of \paperwidth in additional arguments of \includegraphics. When I try to do it in my scrartcl document, it doesn't work. Apparently it only works in the article documentclass. Do you know a workaround for scrartcl?

image not scaled to pagewidth

\documentclass[bibliography=totoc, ngerman]{scrartcl}
\usepackage{graphicx}

\begin{document}
    \begin{figure}
        \includegraphics[width=\paperwidth]{EM_Spektrum.pdf}
    \end{figure}
\end{document}

2 Answers 2

6

This has nothing to do with the document class, but only with the fact that you forgot to center the figure.

\documentclass[bibliography=totoc, ngerman]{scrartcl}
\usepackage{graphicx}
\begin{document}
    \begin{figure}
        \centerline{\includegraphics[width=\paperwidth]{EM_Spektrum.pdf}}
    \end{figure}
\end{document}

enter image description here

1
  • I tried using \centering but it didn't help. \centerline works like a charm.
    – user149098
    Dec 17, 2017 at 0:21
2

edit:

i suggest local increase text width to page width. this can be done:

  • by help of package changepage (works at any documentclass) or
  • width addmargin (works at document classes from koma bundle)

with use of adjustwidth from ˙changepage`:

\documentclass{scrartcl}
\usepackage[a4paper,
            margin=25mm]{geometry}
\usepackage[demo]{graphicx}
\usepackage{changepage}

%-------------------------------- show page layout, only for test
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
    \begin{figure}
\begin{adjustwidth}{-25mm}{-25mm}
        \includegraphics[width=\linewidth]{EM_Spektrum.pdf}
\end{adjustwidth}
    \end{figure}
\end{document}

with use of addmargin:

\documentclass{scrartcl}
\usepackage[a4paper,
            margin=25mm]{geometry}
\usepackage[demo]{graphicx}

%-------------------------------- show page layout, only for test
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
    \begin{figure}
\begin{addmargin}[-25mm]{-25mm}
        \includegraphics[width=\linewidth]{EM_Spektrum.pdf}
\end{addmargin}
    \end{figure}
\end{document}

in both cases the result is the same:

enter image description here

3
  • 1
    Why do you use an extra package instead of using addmargin? Dec 17, 2017 at 7:25
  • @Schweinebacke, good question :-). at writing of answer i wasn't aware of it and in similar circumstances i usual use showed approach.
    – Zarko
    Dec 17, 2017 at 8:41
  • Sorry for the nasty rhetoric question. ;-) Maybe you could add an alternative example with addmargin. Dec 18, 2017 at 7:17

You must log in to answer this question.