1

For use as a headline in beamer, I would like to scale the following tikz image to \paperwidth, preserving the x-y-ratio. I seem to be too dumb to find this (easy?!) solution... Thanks for any help!

Example:

\documentclass{beamer}
\usepackage{tikz}
\begin{document}
\begin{frame}{A Frame}
\begin{tikzpicture} %
\draw[color=blue, fill=blue] (0,0) .. controls (5.30, 1.76) and (10.55, 1.32) .. (10.61, 1.32) -- (10.61, 1.75) -- (0,1.75) -- (0,0);        
\end{tikzpicture}
\end{frame}
\end{document}

1 Answers1

5

The question linked above is related, but it is about fitting with the text width. Hence I hope the following will be useful.

With tikzscale:

\documentclass{beamer}
\usepackage{tikz}
\usepackage{tikzscale}
\usepackage{filecontents}
\begin{filecontents*}{myfig.tikz}
  \begin{tikzpicture} %
     \draw[color=blue, fill=blue] (0,0) .. controls (5.30, 1.76) and (10.55, 1.32) .. (10.61, 1.32) -- (10.61, 1.75) -- (0,1.75) -- (0,0);
  \end{tikzpicture}
\end{filecontents*}
\begin{document}
\begin{frame}{A Frame}
  \begin{center}
    \makebox[0pt]{%
        \includegraphics[width=\paperwidth]{myfig.tikz}
        }
  \end{center}
\end{frame}
\end{document}

With adjustbox:

\documentclass{beamer}
\usepackage{tikz}
\usepackage{adjustbox}
\begin{document}
\begin{frame}{A Frame}
  \begin{adjustbox}{width=\paperwidth,center}
    \begin{tikzpicture} %
       \draw[color=blue, fill=blue] (0,0) .. controls (5.30, 1.76) and (10.55, 1.32) .. (10.61, 1.32) -- (10.61, 1.75) -- (0,1.75) -- (0,0);
    \end{tikzpicture}
  \end{adjustbox}
\end{frame}
\end{document}

On barefoot:

\documentclass{beamer}
\usepackage{tikz}
\begin{document}
\begin{frame}{A Frame}
  \begin{center}
    \makebox[0pt]{\resizebox{\paperwidth}{!}{%
    \begin{tikzpicture} %
       \draw[color=blue, fill=blue] (0,0) .. controls (5.30, 1.76) and (10.55, 1.32) .. (10.61, 1.32) -- (10.61, 1.75) -- (0,1.75) -- (0,0);
    \end{tikzpicture}%
    }%
    }
  \end{center}
\end{frame}
\end{document}

enter image description here