[Tex/LaTex] Bold text at 1., 2., 3., 4. etc

boldmath-mode

Is it possible to make all numbers followed by a point bold? Having thousands of questions to make bold is a tough effort. For example, if I have answers to some questions like this:

1. $8+2 \cdot 3 + 1 = 15$

2. 5+3=8

3. 4+9 =13

…

Is there any code I can write in the beginning of the document to produce all the 1., 2. etc. in a bold text?

Best Answer

TeX is a programming language so you can do most things with a bit of effort, but that doesn't mean you should. The following implements the requested test but the input markup is weird, and the resulting output is horrible. In particular why math mode for the first (because of the \cdot) but not the others (so the fonts and spacing are all wrong).

You should almost never number anything explicitly in LaTeX it is set up to number and cross reference automatically.

enter image description here

\documentclass{article}
\makeatletter
\def\mytest{\afterassignment\mytestx\hmm0}
\def\mytestx{\@ifnextchar.\mytestxx{\ifnum\hmm>\z@\the\hmm\space\fi}}
\def\mytestxx.{\textbf{\the\hmm.}}
\makeatother
\begin{document}
\everypar{\mytest}
\newcount\hmm

Some words

1. $8+2 \cdot 3 + 1 = 15$

2. 5+3=8

3. 4+9 =13

123. 14-49 =horrible


More words

1 has no dot.

\end{document}