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.

Possible Duplicate:
Why do the less than symbol (<) and the greater than symbol (>) appear wrong as upside down exclamation or question mark?

I have the following code

\begin{algorithm}
\begin{algorithmic}[h]

\IF{$valuea$ < $valueb$}
    \STATE $valuer$ = 255
\ENDIF

\end{algorithmic}
\end{algorithm}

but it is printed on pdf like this

if value_a¡valueb then
valuer = 255
end if

with the "¡" symbol instead of the "<" is there a way to force using "<" symbol?

share|improve this question
add comment

marked as duplicate by Werner, Ulrich Schwarz, egreg, Claudio Fiandrino, percusse Jul 17 '12 at 13:45

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

In pure answer to the question, any of the solutions provided by Why do the less than symbol (<) and the greater than symbol (>) appear wrong as upside down exclamation or question mark? will solve the problem. The easiest is probably to add

\usepackage{lmodern}% http://ctan.org/pkg/lmodern

to your document preamble. However...

...when using mathematical expressions, maintain the appropriate spacing by keeping the context mathematical. I would therefore suggest the following:

enter image description here

\documentclass{article}
\usepackage{algorithm}% http://ctan.org/pkg/algorithms
\usepackage{algorithmic}% http://ctan.org/pkg/algorithms
\begin{document}
\begin{algorithm}
  \begin{algorithmic}[1]
    \IF{$\mbox{value}_a<\mbox{value}_b$}
      \STATE $\mbox{value}_r=255$
    \ENDIF
  \end{algorithmic}
\end{algorithm}
\end{document}

The operator spacing between the relations < and = will be kept better than using your original $valuea$ < $valueb$.

You may also consider transitioning to the more flexible algorithmicx bundle.

share|improve this answer
add comment

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