0
\begin{algorithm}
\FOR{$1\leq i \leq M$}
\WHILE{$x)>x_1$}
Hello world
\ENDWHILE
\STATE Set y=2  
\ENDFOR 

Hello everyone, I have a question regarding the algorithm in the latex. I want to bold the text

hello world

in the above algorithm. I want to italic the font of

For

and

While

and only

hello world

should be bold. could any one help me? Thank you so much.

1
  • it would be helpful to give the complete MWE starting from documentclass and finishing at enddocument – js bibra Feb 16 '20 at 4:33
0

For Bold

Simply enclose in braces and use command textbf

\textbf{Hello world}

enter image description here

For Italics

Put the following line in the preamble for italics and bold For

\renewcommand{\algorithmicfor}{\textit{\textbf{for}}}

Put the following line in the preamble for italics and bold While

\renewcommand{\algorithmicwhile}{\textit{\textbf{while}}}

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.