1

I am trying to fit this circuit in beamer presentation.

\documentclass[aspectratio=169]{beamer}
\usepackage{tikz}
\usepackage{circuitikz}
\begin{document}
\begin{frame}{Lets unfold the box}

\begin{figure}
\begin{center}
\begin{tikzpicture}{scale=0.5}

\draw (0,2.5)                   coordinate[label=above:$H$] (H)
to[short](15,2.5)               coordinate[label=above:$G$] (G)
(0,-2.5)                        coordinate[label=above:$E$] (E)
to[short](15,-2.5)              coordinate[label=above:$F$] (F)
(0,7.5)
to[short](15,7.5)
(0,-7.5)
to[short](15,-7.5)
(15,7.5)
to[short](15,-7.5)
(0,7.5)
to[short](0,-7.5)
(5,2.5)                        coordinate[label=above:$D$] (D)
to[short](5,-2.5)              coordinate[label=above:$A$] (A)
(10,2.5)                       coordinate[label=above:$C$] (C)
to[short](10,-2.5)             coordinate[label=above:$B$] (B);

\fill[orange,opacity=0.4](A)--(B)--(C)--(D)--cycle;
\fill[red,opacity=0.4](A)--(D)--(H)--(E)--cycle;
\fill[blue,opacity=0.4](B)--(C)--(G)--(F)--cycle;


\end{tikzpicture}
\end{center}
\end{figure}


\end{frame}

\end{document}

But it will not fit in the frame. How do I make it fit in a frame?

  • 4
    Change {scale=0.5} to [scale=0.5] and replace \begin{center}...\end{center} by \centering. – Ignasi Jan 15 '19 at 9:15
  • Actually you don't need any \centering at all, figures are centred by default in beamer – samcarter_is_at_topanswers.xyz Jan 15 '19 at 9:22
  • @Ignasi Would you like to convert your comment into an answer? – samcarter_is_at_topanswers.xyz Jan 15 '19 at 15:09
  • @samcarter Done. – Ignasi Jan 15 '19 at 20:10
3

This is just a typping problem. {scale=0.5} is not correct and doesn't produce the desired effect. If you replace it for [scale=0.5] which is the correct syntax, the figure is scaled as desired.

I also suggested to replace \begin{center}...\end{center} with \centering, but thanks to samcarter, I've learned that \centering is a default behaviour in beamer figures.

\documentclass[aspectratio=169]{beamer}
\usepackage{tikz}
\usepackage{circuitikz}
\begin{document}
\begin{frame}{Lets unfold the box}

\begin{figure}
%\centering
\begin{tikzpicture}[scale=0.5]

\draw (0,2.5)                   coordinate[label=above:$H$] (H)
to[short](15,2.5)               coordinate[label=above:$G$] (G)
(0,-2.5)                        coordinate[label=above:$E$] (E)
to[short](15,-2.5)              coordinate[label=above:$F$] (F)
(0,7.5)
to[short](15,7.5)
(0,-7.5)
to[short](15,-7.5)
(15,7.5)
to[short](15,-7.5)
(0,7.5)
to[short](0,-7.5)
(5,2.5)                        coordinate[label=above:$D$] (D)
to[short](5,-2.5)              coordinate[label=above:$A$] (A)
(10,2.5)                       coordinate[label=above:$C$] (C)
to[short](10,-2.5)             coordinate[label=above:$B$] (B);

\fill[orange,opacity=0.4](A)--(B)--(C)--(D)--cycle;
\fill[red,opacity=0.4](A)--(D)--(H)--(E)--cycle;
\fill[blue,opacity=0.4](B)--(C)--(G)--(F)--cycle;


\end{tikzpicture}

\end{figure}


\end{frame}

\end{document}

enter image description here

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.