6

I use the following code to obtain a listed item

\documentclass{article}
\usepackage{paralist}

\begin{document}
\begin{inparaenum}[(a)]
\item first item,
\item second item,
\item last item
\end{inparaenum}
\end{document}

I would like to have the counters, in this case: (a), (b), (c) to be formatted in bold (\bfseries). However, only the counter itself and not the surrounding parentheses should be in bold.

obviously the following doesnt work:

\begin{inparenum}[\bfseries{(a)}]

So can I achieve what I want without hardcoding the package?

  • 2
    The reason this doesn't work is that \bfseries is not a macro that takes an argument; (that command is \textbf{}) it's a switch that "turns on" boldface. Your posted answer also doesn't work, but lockstep's does for this reason: you need to turn boldface on inside the paretheses and then turn it off again, which is exactly what his solution does. – Alan Munn May 24 '11 at 15:59
  • 1
    And you should accept egreg's answer, instead of lockstep's for the reasons stated... (This is one reason why it's a good idea to wait some time before accepting an answer.) – Alan Munn May 24 '11 at 16:11
12

The "right" answer is

\begin{inparaenum}[(\bgroup\bfseries a\egroup)]

Calling \normalfont after a is not really a solution, as this might give a closing parenthesis different from the opening one (if the current font is slanted, for example).

  • @WillRobertson and @JosephWright concluded in tex.stackexchange.com/a/1932/16940 that \begingroup is usually preferable to \bgroup, but that there are situations where the latter has to be used. Does it make a difference here or is it just a matter of taste? – anonymous Aug 31 '12 at 11:25
  • @anonymous In this case it doesn't make any difference; what's important is not using {...} that would defeat the search for the a that states how to number the items. – egreg Aug 31 '12 at 13:02
  • Ah, now I got it: \**b**group stands for begin-group and \**e**group for end-group! Why didn't I realise before... – Nikos Alexandris Jan 3 '13 at 11:09
2
\documentclass{article}
\usepackage{paralist}

\begin{document}
\begin{inparaenum}[(\bfseries a\normalfont)]
\item first item,
\item second item,
\item last item
\end{inparaenum}
\end{document}
0

Interestingly, the following achieves exactly what i wanted:

\documentclass{article}
\usepackage{paralist}

\begin{document}
\begin{inparaenum}[\bfseries{} (a)]
\item first item,
\item second item,
\item last item
\end{inparaenum}
\end{document}
  • No, it doesn't -- both parentheses are still bold in your example. Add \normalfont before the closing parenthesis, compile and compare. – lockstep May 24 '11 at 15:57
  • This doesn't do what you want. – Alan Munn May 24 '11 at 15:59
  • hmm.. it's very hard to see with the demifont i'm using but it appears you're right. – Timtico May 24 '11 at 16:00

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.