2

I use beamerarticle to write lecture notes, but use a lot of lists on the slides that I don't need in lecture mode. Is there a way to toggle between a list and a plain text environment as in the following code, but without all the \only commands?

% toggle between line 1 and lines 2-3 for slides or notes
%\documentclass[ignorenonframetext]{beamer} 

\documentclass{article} 
\usepackage[noxcolor]{beamerarticle}

\begin{document}

\begin{frame}
\only<presentation>{\begin{itemize}[<+->]}
\only<presentation>{ \item} Am I  a list
\only<presentation>{ \item}or just a line of text?
\only<presentation>{\end{itemize}}
\end{frame}


\end{document}  

Specifically, I'm looking for a code that will require at most one wrapper, not a separate addition to each individual \item, and it should still be compatible with overlay specifications.

1 Answer 1

2

NEW ANSWER:

\def\presentation{1}

\ifnum\presentation=1
\documentclass[ignorenonframetext]{beamer}
\newenvironment{mitemize}[1][]{\def\Arg{#1}\ifx\Arg\empty\itemize\else\itemize[#1]\fi}{\enditemize}
\else
\documentclass{article} 
\usepackage[noxcolor]{beamerarticle}
%\let\olditemize\itemize
%\let\endolditemize\enditemize
\newenvironment{mitemize}[1][]{\let\item\relax
}{}
%\renewenvironment{itemize}[1][]{\def\Arg{#1}\def\Ignored{<+->}\olditemize\ifx\Arg\empty\relax\else\ifx\Arg\Ignored\relax\else[#1]\fi\fi}{\endolditemize}
\fi

\begin{document}

\begin{frame}
\begin{itemize}[<+->]
\item am I  a list
\item or just a line of text?
\end{itemize}

\begin{mitemize}[<+->]
\item am I  a list
\item or just a line of text?
\end{mitemize}
\end{frame}


\end{document} 

OLD ANSWERS:

Here is a way:

% define as 1 for presentation or another number else.
\def\presentation{1}

\ifnum\presentation=1
\documentclass[ignorenonframetext]{beamer}
\newenvironment{mitemize}[1][]{\itemize[#1]\let\mitem\item}{\enditemize}

\else
\documentclass{article} 
\usepackage[noxcolor]{beamerarticle}
\newenvironment{mitemize}[1][]{\let\mitem\relax}{}
\fi

\begin{document}

\begin{frame}
\begin{mitemize}
\mitem am I  a list
\mitem or just a line of text?
\end{mitemize}
\end{frame}


\end{document} 

Edit:

If you want to use itemize environment in the non-presentation mode just a few times, try the mitemize environment only for these cases that will work as itemize in every mode... In other case the result will be your required:

\def\presentation{0}

\ifnum\presentation=1
\documentclass[ignorenonframetext]{beamer}
\newenvironment{mitemize}[1][]{\def\Arg{#1}\itemize\ifx\Arg\empty\relax\else[#1]\fi}{\enditemize}
\else
\documentclass{article} 
\usepackage[noxcolor]{beamerarticle}
\let\olditemize\itemize
\let\endolditemize\enditemize
\renewenvironment{itemize}[1][]{\let\item\relax
}{\endolditemize}
\newenvironment{mitemize}[1][]{\def\Arg{#1}\olditemize\ifx\Arg\empty\relax\else[#1]\fi}{\endolditemize}
\fi

\begin{document}

\begin{frame}
\begin{itemize}
\item am I  a list
\item or just a line of text?
\end{itemize}

\begin{mitemize}
\item am I  a list
\item or just a line of text?
\end{mitemize}
\end{frame}


\end{document} 

enter image description here

enter image description here

18
  • 1
    I don't understand all the code, but it doesn't make the list code itself any simpler, does it? What I'm looking to avoid is to have to add code to every single item; I'll update the question to clarify.
    – mimuller
    Aug 23, 2019 at 22:06
  • 1
    @mimuller edited
    – koleygr
    Aug 23, 2019 at 22:17
  • 1
    @mimuller Added a way for this requirement too .. but may be if you want to use a itemize inside your non presentation you should use the mitemize environment.
    – koleygr
    Aug 23, 2019 at 22:33
  • 1
    oh perfect! Now it's exactly what I need, thanks!!
    – mimuller
    Aug 23, 2019 at 22:38
  • 1
    Actually, the bottom code doesn't compile on my end right now. It says "Something's wrong--perhaps a missing \item." Will check again when I come back.
    – mimuller
    Aug 23, 2019 at 22:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .