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'm using algorithmic package and I write algorithms. It seems OK but the operators, like IF, ELSE, FOR, ENDIF, etc., are not bold.

Is there anyone that has an idea?

Here is an example:

\begin{algorithm}
  \caption{Tournament algorithm}
  \label{alg:algoTournament}
\begin{boxedminipage}{155mm}
    \begin{algorithmic}[1]
    \STATE $fitness \leftarrow 0$
    \STATE $groupIndex \leftarrow -1$
    \FOR {$i \leftarrow 1$ to $tournamentSize$}
        \STATE Select a random group G1
        \IF {$G1$ in $selectedGroups$}
            \STATE Select another group for G1
        \ENDIF
        \IF {$fitness < fitnessOfSelectedGroup$}
            \STATE {$fitness=fitnessOfSelectedGroup$}
            \STATE {$groupIndex=indexOfSelectedGroup$}
        \ELSE 
            \STATE continue
        \ENDIF
        \STATE Add $G1$ to $selectedGroups$
    \ENDFOR
    \STATE return $groupIndex$
   \end{algorithmic}
\end{boxedminipage}
 \vskip17.5pt
\end{algorithm}
share|improve this question

1 Answer 1

up vote 5 down vote accepted
  • Use a font which provides a bold typeface

  • Check your log file for font warnings

This minimal example shows bold operators in your code:

\documentclass{article}
\usepackage[hmargin=3cm]{geometry}
\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage{boxedminipage}
\begin{document}
\begin{algorithm}
  \caption{Tournament algorithm}
  \label{alg:algoTournament}
\begin{boxedminipage}{155mm}
    \begin{algorithmic}[1]
    \STATE $fitness \leftarrow 0$
    \STATE $groupIndex \leftarrow -1$
    \FOR {$i \leftarrow 1$ to $tournamentSize$}
        \STATE Select a random group G1
        \IF {$G1$ in $selectedGroups$}
            \STATE Select another group for G1
        \ENDIF
        \IF {$fitness < fitnessOfSelectedGroup$}
            \STATE {$fitness=fitnessOfSelectedGroup$}
            \STATE {$groupIndex=indexOfSelectedGroup$}
        \ELSE 
            \STATE continue
        \ENDIF
        \STATE Add $G1$ to $selectedGroups$
    \ENDFOR
    \STATE return $groupIndex$
   \end{algorithmic}
\end{boxedminipage}
 \vskip17.5pt
\end{algorithm}
\end{document}

enter image description here

share|improve this answer
    
Thanks a lot. I've checked log file and as you guessed there was a Font warning. It was about my style file. I commented some lines about winfonts package and now it works OK! –  small_ticket Jul 2 '11 at 16:45

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.