I don't know if I get exactly the point, but my answer tries to make a table in which automatically you have some color definition just inserting the name (based on Retrieve the color definition in HTML I defined).
With respect to Andrew's nice answer, mine just uses internal commands of xcolor
to define macros able to extract the color value with a given format.
Code:
\documentclass{beamer}
\usetheme{CambridgeUS}
\usepackage{lmodern}
\usepackage{booktabs}
\newcommand{\extractHTML}[1]{\extractcolorspecs{#1}{\model}{\mycolor} \convertcolorspec{\model}{\mycolor}{HTML}\printcol \printcol}
\newcommand{\extractRGB}[1]{\extractcolorspecs{#1}{\model}{\mycolor} \convertcolorspec{\model}{\mycolor}{RGB}\printcol \printcol}
\newcommand{\extractCMYK}[1]{\extractcolorspecs{#1}{\model}{\mycolor} \convertcolorspec{\model}{\mycolor}{cmyk}\printcol \printcol}
\newcommand{\colrow}[1]{{\color{#1}#1} & \extractRGB{#1} & \extractCMYK{#1} & \extractHTML{#1}}
\setbeamercolor{block title alerted}{fg=yellow}
% Create Color definition From Template:
% #1 template name,
% #2 foreground color name
% #3 background color name
\newcommand{\ccft}[3]{
\usebeamercolor{#1}
\definecolor{#2}{named}{fg}
\definecolor{#3}{named}{bg}
}
\ccft{block title}{myblock title fg}{myblock title bg}
\ccft{block body}{myblock body fg}{myblock body bg}
\ccft{block title alerted}{myblock title alerted fg}{myblock title alerted bg}
\ccft{palette secondary}{palette secondary fg}{palette secondary bg}
\usebeamercolor{block body}
\begin{document}
\begin{frame}{Color definitions}
\begin{center}
\begin{tabular}{cccc}
\toprule
\multicolumn{1}{c|}{\textsc{Color}} &
\multicolumn{1}{c}{\textsc{RGB}} &
\multicolumn{1}{c}{\textsc{CMYK}} &
\multicolumn{1}{c}{\textsc{HTML}}\\
\midrule
\colrow{structure.fg}\\
\colrow{structure.bg}\\
\colrow{alerted text.fg}\\
\colrow{example text.fg}\\
\colrow{normal text.fg}\\
\colrow{myblock title fg}\\
\colrow{myblock title bg}\\
\colrow{myblock body fg}\\
\colrow{myblock body bg}\\
\colrow{myblock title alerted fg}\\
\colrow{myblock title alerted bg}\\
\colrow{palette secondary fg}\\
\colrow{palette secondary bg}\\
\bottomrule
\end{tabular}
\end{center}
\end{frame}
\end{document}
Result:
Some explanation
Some colors are immediately accessible, for example structure.fg
, alerted text.fg
, while for other like palettes
or blocks
is different. To cope with that, I referenced to Jake's answer in On using beamer's colors in a Tikz picture therefore a workaround is to declare first \usebeamercolor{palette primary}
, for example, and later just use bg
. That's the purpose of the command \ccft
that defines two colors (color name provided by the second and third argument) starting from a template.
Here is an example that shows how to it's possible to retrieve the colors for all types of blocks assuming to adopt the Frankfurt theme and the crane color theme.
Blocks are characterized by a the color of the title (background bg
and foreground fg
) and the color of the body (again background bg
and foreground fg
).
The example could be seen as a sort of black box to detect blocks colors for any pair of Beamer theme and Beamer color theme: just copy the code in a new document blocks_colors.tex
and change the apposite themes definition.
\documentclass{beamer}
\usepackage{lmodern}
\usepackage{booktabs}
%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Theme characteristics -
\usetheme{Frankfurt}
\usecolortheme{crane}
%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Commands -
\newcommand{\extractHTML}[1]{\extractcolorspecs{#1}{\model}{\mycolor} \convertcolorspec{\model}{\mycolor}{HTML}\printcol \printcol}
\newcommand{\extractRGB}[1]{\extractcolorspecs{#1}{\model}{\mycolor} \convertcolorspec{\model}{\mycolor}{RGB}\printcol \printcol}
\newcommand{\extractCMYK}[1]{\extractcolorspecs{#1}{\model}{\mycolor} \convertcolorspec{\model}{\mycolor}{cmyk}\printcol \printcol}
\newcommand{\colrow}[1]{{\color{#1}#1} & \extractRGB{#1} & \extractCMYK{#1} & \extractHTML{#1}}
% Create Color definition From Template (both background and foreground colors):
% #1 template name,
% #2 foreground color name
% #3 background color name
\newcommand{\ccft}[3]{
\usebeamercolor{#1}
\definecolor{#2}{named}{fg}
\definecolor{#3}{named}{bg}
}
% Blocks color definition (background and foreground)
\ccft{block title}{block title fg}{block title bg}
\ccft{block body}{block body fg}{block body bg}
\ccft{block title alerted}{block title alerted fg}{block title alerted bg}
\ccft{block body alerted}{block body alerted fg}{block body alerted bg}
\ccft{block title example}{block title example fg}{block title example bg}
\ccft{block body example}{block body example fg}{block body example bg}
\begin{document}
\begin{frame}{Block Color definitions - Crane color theme}
\scalebox{0.875}{
\begin{tabular}{cccc}
\toprule
\multicolumn{1}{c|}{\textsc{Color}} &
\multicolumn{1}{c}{\textsc{RGB}} &
\multicolumn{1}{c}{\textsc{CMYK}} &
\multicolumn{1}{c}{\textsc{HTML}}\\
\midrule
\colrow{block title fg}\\
\colrow{block title bg}\\
\colrow{block body fg}\\
\colrow{block body bg}\\
\colrow{block title alerted fg}\\
\colrow{block title alerted bg}\\
\colrow{block body alerted fg}\\
\colrow{block body alerted bg}\\
\colrow{block title example fg}\\
\colrow{block title example bg}\\
\colrow{block body example fg}\\
\colrow{block body example bg}\\
\bottomrule
\end{tabular}
}
\end{frame}
\begin{frame}
\begin{block}{Title}
text
\end{block}
\begin{exampleblock}{Title}
text
\end{exampleblock}
\begin{alertblock}{Title}
text
\end{alertblock}
\end{frame}
\end{document}
Result:
You can combine beamer and exam classes by using the beamerarticle
package:
% For the presentation
\documentclass[ignorenonframetext]{beamer}
% for the questions and answers
%\documentclass{exam}
%\usepackage[notheorems]{beamerarticle}
\begin{document}
\begin{questions}
\question[10]
Why is there air?
\question[15]
How much wood would a woodchuck chuck if a woodchuck could chuck
wood?
\question[10] Compute $\displaystyle\int_0^1 x^2 \, dx$.
\end{questions}
\begin{frame}
content...
\end{frame}
\end{document}
Another approach: recreate the environments you need in beamer
\documentclass[notheorems]{beamer}
\newenvironment{questions}{}{}
\newcommand{\question}{}
% For the solution file
%\newenvironment{solution}{}{}
%For printing the student version
\newenvironment{solution}{\color{white}}{}
\begin{document}
\begin{frame}
\begin{questions}
\question Is this a test?
\begin{solution}
Yes, this is a test.
\end{solution}
\end{questions}
\end{frame}
\end{document}
Best Answer
Simply replace the mentioned LaTeX commands with
\includegraphics[<options>]{<image>}
(graphicx
package). You can adjust the scale or height of the images using thescale
andheight
option, receptively. Using eitherex
orem
as unit for the height will scale the image depending on the font size.For beamer you do it the following way (See also Change bullet style / formatting in Beamer)
For the normal
itemize
you can redefine\labelitemi
,\labelitemii
,\labelitemiii
and\labelitemiv
for the four possible nesting levels.If you want to have different images for different items you should simply define macros which call
\item
with the optional argument as described by me in How to define a list with custom symbols?.For images this would look e.g. like this: