0

I'm doing a beamer presentation and defined some custom itemize bullets, which look like this:

\newcommand{\pro}{\item[\textbf{\color{green}+}]}
\newcommand{\con}{\item[\hspace{-2ex}\textbf{\color{red}--}]}

They work very well, but are not centered under eachother, the \con sign is more indented than the \pro sign.

I tried

\begin{itemize}[align=center]

with no effect.

Is there a way without using enumitem (which isn't quite compatible to beamer) to align the customized bullets in a centered position?

Maybe it's also possible with enumitem and I haven't found the right way to implement it yet?

  • the bullet points are right aligned by default, so your \hspace is on the wrong side. Try something like \newcommand{\con}{\item[\textbf{\color{red}--}\hspace{0.05cm}]} – user36296 Nov 29 '15 at 11:40
  • Thanks, that did work. But is there maybe a more elegant way to do this? – Knigge46 Nov 29 '15 at 11:43
2

You can have what you want with mathtools and its \(math)clap command.

I defined differently your custom bullets, in math mode. Note the endash has not the same width as the + character.

\documentclass{beamer}
\usepackage{mathtools}

\newcommand{\pro}{\item[\boldmath$\mathclap{\color{green}+}$ ]}
\newcommand{\con}{\item[\boldmath$ \mathclap{\color{red}-}$ ]}

\begin{document}

\begin{frame}
  \begin{itemize}
    \pro item1 
    \con item2
  \end{itemize}
\end{frame}

\end{document} 

Note: If the symbols that you want to use all have the same width, the mathclap command is not necessary.

enter image description here

  • Is \mathclap necessary? In math mode plus and minus have the same width in most fonts. – egreg Nov 29 '15 at 15:54
  • It was just in case. Actually, I initially retained the endash and it then was necessary. Furthermore, I'm not sure, these are the only symbols the O?P. wants to use. I'll add some explanations about this. – Bernard Nov 29 '15 at 16:17
  • The $\boldmath$ solution didn't come to my mind, that one does the job very well! :) And as @egreg said, if you only use + and -, you won't need the \mathclap. But for further use, I'll keep that in mind. – Knigge46 Dec 1 '15 at 9:19
  • Can this be generalized somehow so that mixing \item with \item[\customSymbol] works correctly? Default bullets are right-aligned (as if in \llap) and wider custom symbols stick out on the left. – eudoxos Apr 11 '16 at 6:48
  • @eudoxos: It seems that with beamer and just the above code, everything is centred (I've just tested with a custom ++ label). Could you post a minimal example demonstrating the problem? – Bernard Apr 11 '16 at 8:30
0

Since the + is larger than --, I centered the -- in the same space. This was complicated by the fact that -- is slightly assymetrical as demonstrated in the \fbox demos, and of course beamer redefining everything.

\documentclass{beamer}

\newlength{\tempdima}

\newcommand{\pro}{\item[\color{green}\textbf{+}]}
\newcommand{\con}{\item[\settowidth{\tempdima}{\textbf{+}}%
  \hbox to \tempdima{\hfill\hspace{.07ex}\color{red}\textbf{--}\hfill}]}

\begin{document}

\begin{frame}
  \begin{itemize}
    \pro item1
    \con item2
  \end{itemize}
\fboxsep=0pt
\fbox{\textbf{--}}
{\Huge\fbox{\hspace{.07ex}\textbf{--}}}
{\tiny\fbox{\hspace{.07ex}\textbf{--}}}
\end{frame}

\end{document}

+ and --

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.