General[beamer] newcommand/newenvironment for frame with verbatim

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
dagna
Posts: 16
Joined: Wed Mar 03, 2010 7:28 pm

[beamer] newcommand/newenvironment for frame with verbatim

Post by dagna »

Hi!

It's my example frame definition for Yacas algebra function:

Code: Select all

\begin{frame}[fragile]
  \transboxout
  \frametitle{Permutations}
  \begin{columns}
    \column{.475\textwidth}
      \begin{block}{Description}
        All permutations of list
      \end{block}
      \begin{block}{Calling}
        \texttt{Permutations(list)}
      \end{block}
      \begin{block}{Parameters}
        list – parameters list 
      \end{block}
    \column{.475\textwidth}
      \begin{block}{Examples}
        \footnotesize
        \begin{verbatim}
          In> Permutations({a,b,c})
          Out> {{a,b,c},{a,c,b},
          {c,a,b},{b,a,c},{b,c,a},
          {c,b,a}};
        \end{verbatim}
    \end{block}
  \end{columns}
\end{frame}
It is very long and I have got 35 functions to descriptions :( Is it possible to create newcommand or environment for following result?

Code: Select all

\myfunction{Permutations}{All permutations of list}{Permutations(list)}{list – parameters list}{In> Permutations({a,b,c})
Out> {{a,b,c},{a,c,b},{c,a,b},{b,a,c},
{b,c,a},{c,b,a}};}

I tried do it like this, but it doesn't work:

Code: Select all

\newcommand{funkcjaAlgebryLiniowej}[5]{
\begin{frame}[fragile]
  \transboxout
  \frametitle{#1}
  \begin{columns}
    \column{.475\textwidth}
    \begin{block}{Przeznaczenie funkcji}
      #2
    \end{block}
    \begin{block}{Wywołanie}
      \texttt{#3}
    \end{block}
    \begin{block}{Parametry}
      #4 
    \end{block}
    \column{.475\textwidth}
    \begin{block}{Przykłady}
      \footnotesize
      \begin{verbatim}
        #5
      \end{verbatim}
    \end{block}
  \end{columns}
\end{frame}
}
Best regards!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

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

Post Reply