RE: Slide style with varying font size for different item levels

"Hendri Adriaens" <[email protected]> Mon, 11 Apr 2005 18:47:55 +0200
Newsgroups gmane.comp.tex.latex.prosper.user
Message-ID <[email protected]>
> I am trying to make a slide style, that will allow me to define 
> globally the 
> font size for each of the 3 levels in the itemize environment. 
> Basically I 
> want the font size to be smaller on level 2 and 3 (which is default in 
> PowerPoint).

This is not a prosper problem but a LaTeX problem.
However, prosper does insert an extra layer of
difficulty due to its erroneous manouvres with \item.

So here we go. Let me stress that it isn't possible
without redoing \@item from the latex kernel. However,
as we can assume that you will be using a non-font
item label, we can make a nice workaround. We first
test it in a standard LaTeX class:
\documentclass[12pt]{article}
\makeatletter
\let\old@item\item
\def\item{%
  \ifcase\@itemdepth\or
    \fontsize{12.4pt}{12pt}\selectfont
  \or
    \fontsize{11.2pt}{11pt}\selectfont
  \else
    \fontsize{10pt}{10pt}\selectfont
  \fi
  \old@item
}
\makeatother
\begin{document}
\begin{itemize}
\item level 1
\begin{itemize}
\item level 2
\begin{itemize}
\item level 3
\end{itemize}
\end{itemize}
\end{itemize}
\end{document}

If you play a little with the numbers, you will see
that the size of the item label also changes. That
might not be the effect that we want, but we forget
about that for now as you will insert a fixed size
picture for it anyway.

Now, if we want to port this `solution' to prosper,
we have to take into account that prosper redefines
\item itself (in a dubious way [1]) and that it stores
the original \item definition in \orig@item so that
it can use that internally again. So here, we need
to redefine \orig@item and prosper will pick that
up and set \let\item\orig@item internally.

\documentclass[pdf]{prosper}
\makeatletter
\let\latex@item\orig@item
\def\orig@item{%
  \ifcase\@itemdepth\or
    \fontsize{12.4pt}{12pt}\selectfont
  \or
    \fontsize{11.2pt}{11pt}\selectfont
  \else
    \fontsize{10pt}{10pt}\selectfont
  \fi
  \latex@item
}
\makeatother
\begin{document}
\begin{slide}{test}
\begin{itemize}
\item level 1
\begin{itemize}
\item level 2
\begin{itemize}
\item level 3
\end{itemize}
\end{itemize}
\end{itemize}
\end{slide}
\end{document}

For completeness, here's the `long' solution using
a redefinition of \@item. This works without modification
in prosper, but notice that enumerates are not covered
(also not by the solutions above).

\documentclass[12pt]{article}
\makeatletter
\def\@item[#1]{%
  \if@noparitem
    \@donoparitem
  \else
    \if@inlabel
      \indent \par
    \fi
    \ifhmode
      \unskip\unskip \par
    \fi
    \if@newlist
      \if@nobreak
        \@nbitem
      \else
        \addpenalty\@beginparpenalty
        \addvspace\@topsep
        \addvspace{-\parskip}%
      \fi
    \else
      \addpenalty\@itempenalty
      \addvspace\itemsep
    \fi
    \global\@inlabeltrue
  \fi
  \everypar{%
    \@minipagefalse
    \global\@newlistfalse
    \if@inlabel
      \global\@inlabelfalse
      {\setbox\z@\lastbox
       \ifvoid\z@
         \kern-\itemindent
       \fi}%
      \box\@labels
      \penalty\z@
    \fi
    \if@nobreak
      \@nobreakfalse
      \clubpenalty \@M
    \else
      \clubpenalty \@clubpenalty
      \everypar{}%
    \fi}%
  \if@noitemarg
    \@noitemargfalse
    \if@nmbrlist
      \refstepcounter\@listctr
    \fi
  \fi
  \sbox\@tempboxa{\makelabel{#1}}%
  \global\setbox\@labels\hbox{%
    \unhbox\@labels
    \hskip \itemindent
    \hskip -\labelwidth
    \hskip -\labelsep
    \ifdim \wd\@tempboxa >\labelwidth
      \box\@tempboxa
    \else
      \hbox to\labelwidth {\unhbox\@tempboxa}%
    \fi
    \hskip \labelsep}%
  \ifcase\@itemdepth\or
    \fontsize{12.4pt}{12pt}\selectfont
  \or
    \fontsize{11.2pt}{11pt}\selectfont
  \else
    \fontsize{10pt}{10pt}\selectfont
  \fi
  \ignorespaces}
\makeatother
\begin{document}
\begin{itemize}
\item level 1
\begin{itemize}
\item level 2
\begin{itemize}
\item level 3
\end{itemize}
\end{itemize}
\end{itemize}
\end{document}

Hope that helps.

-Hendri.

[1] see, for instance, bug 3:
http://wikiprosper.bbclone.de/index.php?pagename=ProsperBugs


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click