# create a command with optional argument

as you know if we want use an alternative statement on beamer we can use:

\alt<overlay specification>{default text}{alternative text}<overlay specification>


in my case I always use this format:

\alt<#1>{\color{blue}\item #2 }{\color{gray}\item #2}


where #1 is frame numbers (like 1 or 1-3) and its default value is +(1) and #2 is my alternative text.

I've tried this code:

\newcommand\a[2]{\alt<#1>{\color{blue}\item #2 }{\color{gray}\item #2}}


it works but as you know this is not an optional command, I want to make #1 be an optional argument of my command with +(1) as a default value. any help would be appreciated.

• by the way as I run it first time it said command \a is already defined! I did not define this command before so I used \renewcommand\a. I have no idea about what was \a is by default is anyone know? – asys Sep 7 '17 at 17:07
• Can you please tell us what the command should do? I guess there might be an easier way then a newcommand... – samcarter_is_at_topanswers.xyz Sep 7 '17 at 17:14
• @samcarter I used this way in this minimal code, I would be appreciated if you run this code. – asys Sep 7 '17 at 17:19

Looks like you want to uncover you items:

\documentclass[11pt]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\setbeamercovered{transparent}

\begin{document}

\begin{frame}
\begin{itemize}[<+>]
\item Introduction
\item Welding Define
\item Welding Define
\end{itemize}
\end{frame}

\end{document}


• I want first Item be off in second frame, and cause I used multi photo in next column sometimes I need one Item be 'on'(not off) for multi frames. – asys Sep 7 '17 at 17:26
• @asys See my edit, the first item is switched off again. If one item should be visible for more then one slide, you can always fine control the appearance with \item<3-5> text – samcarter_is_at_topanswers.xyz Sep 7 '17 at 17:31