# Make the some parts of pseudocode bold

I just want some piece of pseudo code (below) to stand out in my algorithm. So I made the all the keywords (if, end for etc) unbold with
\AtBeginEnvironment{algorithmic}{\let\textbf\relax}. Now how I can make this code bold? I am posting the part that needs to be bold.

\documentclass[11pt]{article}
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\AtBeginEnvironment{algorithmic}{\let\textbf\relax}
\usepackage{amsmath}
\usepackage[fleqn]{mathtools}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{fontspec}
\usepackage{bm}
\newcommand*\Let[2]{\State #1 $\gets$ #2}
\algrenewcommand\alglinenumber[1]{
\begin{document}
\begin{algorithm}
\begin{algorithmic}[1]
\State //Explo. Loop
\For{\texttt{$i$ from 1 to $S$}}
\State //Take an exploration step for bacterium {$i$}
\If {$E_t$ = $M_t$}
\Let {$\theta(i,j+1,k)$} random position
\State {$J_{last}$} = {$J(\theta(i,j+1,k))$}
\If {$J_{last}$ < $J(i,j,k)$}
\Let {$J(i,j+1,l)$} {$J_{last}$}
\EndIf
\State end //if
\State {$E_t$} = 0
\EndIf
\State end //if
\EndFor
\State end //Explo. Loop
\State // Exploitation Loop
\For{\texttt{i from 1 to $S$}}
\If {$E_r$ = $M_r$} let bacterium undergo:
\State  (Eq. 7)
\State  (Eq. 8)
\State  (Eq. 9)
\EndIf
\State end //if
\EndFor
\State end //Explo. Loop
\end{algorithmic}
\end{algorithm}
\end{document}

• ...which part is "some part"? – Werner Jan 14 '15 at 15:19
• begin{algorithmic}[1]\bfseries% but this will not set your math bold. So maybe it would be more clever to use some other highlighting approach such as underlining, marking with colour, surrounding with a box, indenting... – LaRiFaRi Jan 14 '15 at 15:28
• Some part means the part I posted. – user2374431 Jan 14 '15 at 16:12

I think it's a bad idea to remove \textbf in that way, but it's an even worse idea to make all the environment boldface.

The algorithm will already stick out by itself, and the boldface keywords help the reader in finding the key places.

However, if you really want to follow this path, just add \bfseries\boldmath to your environment.

\documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage[fleqn]{mathtools}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{fontspec}
\usepackage{bm}
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox

\makeatletter
\AtBeginEnvironment{algorithmic}{\let\textbf\@firstofone}
\makeatother

\setsansfont{Latin Modern Sans} % or \addfontfeatures won't work

\newcommand*\Let[2]{\State #1 $\gets$ #2}
\algrenewcommand\alglinenumber[1]{%

\begin{document}
\begin{algorithm}
\begin{algorithmic}[1]\bfseries\boldmath
\State //Explo. Loop
\For{\texttt{$i$ from 1 to $S$}}
\State //Take an exploration step for bacterium {$i$}
\If {$E_t$ = $M_t$}
\Let {$\theta(i,j+1,k)$} random position
\State {$J_{last}$} = {$J(\theta(i,j+1,k))$}
\If {$J_{last}$ < $J(i,j,k)$}
\Let {$J(i,j+1,l)$} {$J_{last}$}
\EndIf
\State end //if
\State {$E_t$} = 0
\EndIf
\State end //if
\EndFor
\State end //Explo. Loop
\State // Exploitation Loop
\For{\texttt{i from 1 to $S$}}
\If {$E_r$ = $M_r$} let bacterium undergo:
\State  (Eq. 7)
\State  (Eq. 8)
\State  (Eq. 9)
\EndIf
\State end //if
\EndFor
\State end //Explo. Loop
\end{algorithmic}
\end{algorithm}
\end{document}