Fitting tikzpicture in beamer: Difference between using \resizebox and \adjustbox?
\documentclass[10pt]{beamer}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[english]{babel}
\usepackage{color}
\usepackage{float}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{pgf}
\usepackage{setspace}
\usepackage{textcomp}
\usepackage{tikz}
\usepackage{verbatim}
\usepackage{mathrsfs}
\usetikzlibrary{arrows,shapes}
\usepackage{adjustbox}
\usepackage{pgf,tikz}
\mode<presentation>{
\usetheme{Warsaw}
\usecolortheme{crane}
\setbeamertemplate{navigation symbols}{}
\setbeamercovered{transparent}
}
\title{Disks}
\AtBeginSubsection[]{
\begin{frame}<beamer>{Outline}
\tableofcontents[currentsection,currentsubsection]
\end{frame}
}
\begin{document}
\begin{frame}{Initial solution}
%\begin{adjustbox}{max size={.95\textwidth}{.8\textheight}}
\resizebox{11.5cm}{!}{%
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1cm,y=1cm]%, scale=0.5]
\coordinate (b) at (13,3) ;
\coordinate (c) at (14,3) ;
\coordinate (d) at (15,3) ;
\coordinate (i) at (9,5) ;
\coordinate (g) at (9,4) ;
\coordinate (e) at (9,3) ;
\coordinate (n) at (5,3) ;
\coordinate (o) at (4,3) ;
\coordinate (p) at (3,3) ;
\coordinate (a) at (12,3) ;
\coordinate (m) at (6,3) ;
\coordinate (h) at (10,5) ;
\coordinate (j) at (10,4) ;
\coordinate (f) at (10,3) ;
\draw (p) circle [radius = 3];
\draw (d) circle [radius = 3];
\end{tikzpicture}
}%
%\end{adjustbox}
\end{frame}
\end{document}
In the MWE above,
When I use \resizebox to scale the picture, the entire picture (2 disks) are visible, provided I do not exceed 11.5cm (a value found out by trial-and-error, something I want to avoid)
Hence, I tried using adjustbox (as mentioned in the question here), but if I used adjustbox by commenting the resizebox block and uncommenting the adjustbox line, the effect was as if I hadn't used it at all (the disk on the right was completely left out of the picture) What am I doing wrong? I could finish my current slides using resizebox, but I wanted to use the "better" way of "scaling only if required" using adjustbox, and wanted to understand why it isn't happening in my case...
\documentclass[10pt]{beamer}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[english]{babel}
\usepackage{color}
\usepackage{float}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{pgf}
\usepackage{setspace}
\usepackage{textcomp}
\usepackage{tikz}
\usepackage{verbatim}
\usepackage{mathrsfs}
\usetikzlibrary{arrows,shapes}
\usepackage{adjustbox}
\usepackage{pgf,tikz}
\mode<presentation>{
\usetheme{Warsaw}
\usecolortheme{crane}
\setbeamertemplate{navigation symbols}{}
\setbeamercovered{transparent}
}
\title{Disks}
\AtBeginSubsection[]{
\begin{frame}<beamer>{Outline}
\tableofcontents[currentsection,currentsubsection]
\end{frame}
}
\begin{document}
\begin{frame}{Initial solution}
%\begin{adjustbox}{max size={.95\textwidth}{.8\textheight}}
\resizebox{11.5cm}{!}{%
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1cm,y=1cm]%, scale=0.5]
\coordinate (b) at (13,3) ;
\coordinate (c) at (14,3) ;
\coordinate (d) at (15,3) ;
\coordinate (i) at (9,5) ;
\coordinate (g) at (9,4) ;
\coordinate (e) at (9,3) ;
\coordinate (n) at (5,3) ;
\coordinate (o) at (4,3) ;
\coordinate (p) at (3,3) ;
\coordinate (a) at (12,3) ;
\coordinate (m) at (6,3) ;
\coordinate (h) at (10,5) ;
\coordinate (j) at (10,4) ;
\coordinate (f) at (10,3) ;
\draw (p) circle [radius = 3];
\draw (d) circle [radius = 3];
\end{tikzpicture}
}%
%\end{adjustbox}
\end{frame}
\end{document}
In the MWE above,
When I use \resizebox to scale the picture, the entire picture (2 disks) are visible, provided I do not exceed 11.5cm (a value found out by trial-and-error, something I want to avoid)
Hence, I tried using adjustbox (as mentioned in the question here), but if I used adjustbox by commenting the resizebox block and uncommenting the adjustbox line, the effect was as if I hadn't used it at all (the disk on the right was completely left out of the picture) What am I doing wrong? I could finish my current slides using resizebox, but I wanted to use the "better" way of "scaling only if required" using adjustbox, and wanted to understand why it isn't happening in my case...
No comments:
Post a Comment