Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have tried following which works (making the number in second line bold)

\begin{algorithm}[h]
\begin{algorithmic}[1]
\State TSO.assignStartTs()
{\bf\State} TSO.assignCommitTs()
\end{algorithmic}
\end{algorithm}

The problem is if I want to make the same for first linenumber, as below, it does not work, and complaints with Missing endcsname. This looks quite like undefined behaviour to me, and in general, is there anyway to make line number bold?

\begin{algorithm}[h]
\begin{algorithmic}[1]
{\bf\State} TSO.assignStartTs()
{\bf\State} TSO.assignCommitTs()
\end{algorithmic}
\end{algorithm}
share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

The fact that it works in the second line is just by chance. It's better to use a specific command that boldens the next number:

\documentclass{article}
\usepackage{algorithm,algpseudocode}

\newif\ifboldnumber
\newcommand{\boldnext}{\global\boldnumbertrue}

% Default definition is \footnotesize#1:
\algrenewcommand\alglinenumber[1]{%
  \footnotesize\ifboldnumber\bfseries\fi\global\boldnumberfalse#1:}

\begin{document}
\begin{algorithm}[h]
\begin{algorithmic}[1]
\boldnext
\State TSO.assignStartTs()
\State TSO.assignCommitTs()
\end{algorithmic}
\end{algorithm}
\end{document}

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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