Perhaps this is what you need?
\documentclass[10pt,xcolor=table]{beamer}
\usetheme{Madrid}
\usepackage{tikz}
\usepackage{twoopt}
\usetikzlibrary{calc}
\makeatletter
\tikzset{%
remember picture with id/.style={%
remember picture,
overlay,
save picture id=#1,
},
save picture id/.code={%
\edef\pgf@temp{#1}%
\immediate\write\pgfutil@auxout{%
\noexpand\savepointas{\pgf@temp}{\pgfpictureid}}%
},
if picture id/.code args={#1#2#3}{%
\@ifundefined{save@pt@#1}{%
\pgfkeysalso{#3}%
}{
\pgfkeysalso{#2}%
}
}
}
\def\savepointas#1#2{%
\expandafter\gdef\csname save@pt@#1\endcsname{#2}%
}
\def\tmk@labeldef#1,#2\@nil{%
\def\tmk@label{#1}%
\def\tmk@def{#2}%
}
\tikzdeclarecoordinatesystem{pic}{%
\pgfutil@in@,{#1}%
\ifpgfutil@in@%
\tmk@labeldef#1\@nil
\else
\tmk@labeldef#1,(0pt,0pt)\@nil
\fi
\@ifundefined{save@pt@\tmk@label}{%
\tikz@scan@one@point\pgfutil@firstofone\tmk@def
}{%
\pgfsys@getposition{\csname save@pt@\tmk@label\endcsname}\save@orig@pic%
\pgfsys@getposition{\pgfpictureid}\save@this@pic%
\pgf@process{\pgfpointorigin\save@this@pic}%
\pgf@xa=\pgf@x
\pgf@ya=\pgf@y
\pgf@process{\pgfpointorigin\save@orig@pic}%
\advance\pgf@x by -\pgf@xa
\advance\pgf@y by -\pgf@ya
}%
}
\makeatother
\newcommand\tikzmark[2][]{%
\tikz[remember picture with id=#2] #1;}
\newcommandtwoopt\DrawBox[4][][-\labelwidth+\labelsep]{%
\begin{tikzpicture}[overlay,remember picture]
\draw[red,#1]
($(pic cs:#3)+(-0.2em+#2,0.9em)$) rectangle
($(pic cs:#4)+(0.2em,-0.3em)$);
\end{tikzpicture}}
\begin{document}
\begin{frame}
\begin{block}{\centering Unsteady models}
\only<3->{\DrawBox[thick, green!50!black, fill=green!80!black]{lefta}{righta}}
\only<4->{\DrawBox[thick, green!50!black, fill=green!80!black]{leftb}{rightb}}
\begin{itemize}\setbeamertemplate{itemize item}[triangle]\small
\item\tikzmark{lefta}\textbf{Aerodynamics}
\begin{itemize}\small
\item[+] \textbf<3->{Accuracy}
\item[+] \textbf<3->{Flow physics}\tikzmark{righta}
\end{itemize}
\item\tikzmark{leftb}\textbf{Structure}
\begin{itemize}\small
\item[+] \textbf<3->{Full wing flexibility}\tikzmark{rightb}
\end{itemize}
\item \textbf{Implementation}
\begin{itemize}\small
\item[-] Complex formulation
\item[-] High computational load
\end{itemize}
\end{itemize}
\end{block}
\end{frame}
\end{document}
The new \DrawBox
command has two optional arguments: the first one, to pass options to the \draw
command internally used for the frame, and the second one, to control the horizontal offset to the left (default value=-\labelwidth+\labelsep
); the two mandatory arguments are for the marks which should be set in the proper locations.
I used the improved \tikzmark
defined by Andrew Stacey in his answer to tikzmark to have different behaviour if first run (and mark locations not yet available). This, in particular, places the box behind the text, so no need to use opacity (unless its effect is really required).
The solution you're referring to doesn't work in two column mode, because the margin used to print the \marginpar
is the left one when you are in the left column and the right one when you are in the right column.
This is a simple solution that doesn't use the margins to print the checkboxes, but it's far from perfect.
I've defined two new commands
\newcommand\noncheckeditem[1]{\item[--] #1 \hfill $\Box$}%
\newcommand\checkeditem[1]{\item[--] #1 \hfill $\CheckedBox$}%
to be used respectively when you want a non-checked and a checked item.
You can use them inside a normal description
environment as follows:
\documentclass[a4paper,notitlepage]{article}
\usepackage{graphicx}
\usepackage[twocolumn]{geometry}
\usepackage{amssymb}
\usepackage{array}
\usepackage[export]{adjustbox} % draw frame of the image
\geometry{verbose,tmargin=1cm,bmargin=1cm,lmargin=1cm,rmargin=1cm,headheight=1cm,headsep=1cm,footskip=1cm}
\usepackage{wasysym}
\setlength{\columnseprule}{0.4pt}
\setlength{\columnsep}{0.5in}
\newcommand\noncheckeditem[1]{\item[--] #1 \hfill $\Box$}%
\newcommand\checkeditem[1]{\item[--] #1 \hfill $\CheckedBox$}%
\begin{document}
\begin{description}
\checkeditem{Open the \TeX book}
\checkeditem{Find the good page}
\noncheckeditem{Try to understand}
\end{description}
\newpage
\begin{description}
\checkeditem{Open the \TeX book}
\checkeditem{Find the good page}
\noncheckeditem{Try to understand}
\end{description}
\end{document}
Result:
Note that I've printed one on the left and one on the right column just to see how they look. For this purpose, I've also added the lines
\setlength{\columnseprule}{0.4pt}
\setlength{\columnsep}{0.5in}
Also note that the left and the right margin of your geometry
are too small and you get warnings. You should put something like 3.5cm
both for lmargin
and rmargin
.
Best Answer
Welcome, and good question. I don't know of a LaTeX package that can easily do what you want out of the box. The
fancybox
package does a lot of fancy boxes (naturally) but not dashed lines around them.The reason might be that TeX doesn't have native mechanisms for drawing dashed/dotted lines, only solid ones. So to create dashed lines one needs to calculate the number of dashes and draw each one.
LaTeX's built-in
picture
environment can do this, but I never learned too much about it. TikZ can do it:There is probably an improvement to the TikZ code that can be made by using a decoration to draw the shape's border, thereby reducing it to one line of TikZ. But since all you want is a dashed line this will do the trick. You can play around with the settings to get the separation you want or make it customizable.