Graphics, Figures & Tables ⇒ Latex beamer, colorbox, size definition
Latex beamer, colorbox, size definition
Latex Beamer does not really want to do what I want it to do. I want beamer to create a colorbox which is centered on the frame (same distance from the left and the right side of the frame) but is not as broad as the whole frame. Here my code:
\documentclass{beamer}
\begin{document}
\begin{frame}[t]
\setbeamercolor{postit}{fg=black,bg=yellow}
\begin{beamercolorbox}[sep=0em,colsep*=5pt,wd=\textwidth,ht=1cm,dp=1cm,ce nter]{postit}
Place me somewhere!
\end{beamercolorbox}
\setbeamercolor{postit}{fg=black,bg=yellow}
\begin{beamercolorbox}[sep=0em,colsep*=0pt,wd=\textwidth,ht=1cm,dp=1cm,ce nter]{postit}
Place me somewhere!
\end{beamercolorbox}
\setbeamercolor{postit}{fg=black,bg=yellow}
\begin{beamercolorbox}[sep=0em,colsep*=-15pt,wd=\textwidth,ht=1cm,dp=1cm,center]{postit}
Place me somewhere!
\end{beamercolorbox}
\end{frame}
\end{document}
I thought that colsep*=-15pt could solve the issue. However, as the lowest box in the sample above shows, this does not really work since this command only shrinks the right colorbox side but not the left side.
Does anyone have an idea for this?
Cheers
Marcus
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
Latex beamer, colorbox, size definition
Code: Select all
~\hfill\begin{beamercolorbox}[sep=0em,wd=0.7\textwidth,ht=1cm,dp=1cm,center]{postit}
Place me somewhere!
\end{beamercolorbox}\hfill~
Re: Latex beamer, colorbox, size definition
My example is below. When you look at the output you can see that the labelling with
Table 1 - bla bla bla
is not centered any more and has end. There is only one way I found to avoid this: do NOT use the caption package. Even with \usepackage{caption} only (ie, no parameter specifications) the weired layout error shows up.
But without this caption package I cannot count tables, define the table textfont and color etc.
Do you have any idea? Maybe caption is not the error but the \hfill ? Centering as you pointed out does not work either ...
Thanks
Marcus
\documentclass{beamer}
\usepackage{lmodern}
\usepackage[width=0.75\textwidth,skip=10pt,labelsep=endash,textformat=simple,justification=raggedright,labelformat=simple]{caption}
\setbeamerfont{klein}{size*={6.25}{8.50}}
\setbeamercolor{postit}{fg=black,bg=yellow}
\setbeamerfont{tables_and_figures}{size*={5.25}{7.50}} % for labeling tables and figures
\DeclareCaptionFont{tables_and_figures}{\usebeamerfont{tables_and_figures}}
\captionsetup{font=tables_and_figures,labelfont=tables_and_figures,textfont=tables_and_figures}
\begin{document}
\usebeamerfont{normal}
\begin{frame}
\begin{block}{\bf\usebeamerfont{normal}\textcolor{red}{An example of forward and spot quotes:}}
Table \ref{table-1-100} shows the forward and spot exchange quotes for GBP.
\end{block}
\vspace{0.5cm}
~\hfill
\begin{beamercolorbox}[sep=0em,colsep*=0pt,ht=3.0cm,wd=0.5\textwidth,center]{postit}
\begin{table}[ht]
{\usebeamerfont{klein}
\vspace{0.0cm}
\begin{tabular}{l l l}
{\bf Type} & {\bf Bid} & {\bf Offer} \vspace{0.025cm} \\ \hline
Spot & 2.0558 & 2.0562 \vspace{0.025cm} \\
1-month forward & 2.0547 & 2.0552 \vspace{0.025cm} \\
3-month forward & 2.0526 & 2.0531 \vspace{0.025cm} \\
6-month forward & 2.0483 & 2.0489
\end{tabular}
\vspace{0.0cm}
}
\caption{Exchange Quotes for GBP, July 20, 2007. This is a test of the caption setting for a table.}
\label{table-1-100}
\vspace{-0.4cm} %Moves table and caption southwards !
\end{table}
\end{beamercolorbox}
\hfill~
\end{frame}
\end{document}