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 the following LaTeX code:

some text \lstinline!u <= 1! some text

In my output, the two characters <= get automatically joined to form a single "less-than-or-equal" chararacter (i.e. Unicode U+2264). How do I get rid of this feature? It looks nice, but it does not reflect the original syntax.

Some remark: In my case, I'm using a custom definition for the Modelica language. However, I get the very same behaviour when switching to a pre-defined language, i.e. Pascal.

share|improve this question
    
Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. –  Jubobs Mar 28 '13 at 8:20
1  
I finally figured out what was going wrong. The document loaded a style file for the VHDL language. That file introduced the feature I didn't want: \lstset{% % uninteresting stuff literate=% {~}{{$\neg$}}1 % \neg {-}{{-}}1 % prevent ``-'' being replaced by math minus {<=}{{\tiny$\leq$}}1 % \leq {>=}{{\tiny$\geq$}}1 % \geq {~=}{{\tiny$\neq$}}1 % \neq {delta}{{\tiny$\Delta$}}1% \Delta {iend}{{\fontfamily{pcr}\selectfont end}}3% end when indexing matrix elements } –  chris Mar 28 '13 at 9:20
    
Since I didn't look into the style file, I wasn't aware of the replacements. And since \lstset does not configure an individual language I got those replacements even when I selected a language different from VHDL. –  chris Mar 28 '13 at 9:21
    
@chris I suggest your code snippet into a minimal working example (MWE). Also, please put your answer in the Answer box. You can accept your own answer after two days. This marks this problem as solved. It will also earn you reputation points when your answer gets upvoted. –  hpesoj626 Mar 28 '13 at 10:30
1  
If you think others may encounter the same problem, feel free to write a full-blown answer on how to solve it. –  Jubobs Mar 28 '13 at 10:30
add comment

1 Answer

up vote 2 down vote accepted

I finally figured out what was going wrong. To make things clear, I'll start with a MWE which does automatically convert inequalities inside listings:

\documentclass[%
   final,      % fertiges Dokument
     % --- Paper Settings ---
   paper=a4% [Todo: add alternatives]
   paper=portrait, % landscape
   pagesize=auto, % driver
   fontsize=11pt,%
   version=last, %
 ]{scrbook}

\usepackage{listings}
\usepackage{textcomp}

\lstset{%
  breaklines=true,
  showstringspaces=false,                     % do not emphasize spaces in strings
  tabsize=4,                                  % number of spaces of a TAB
  mathescape=false,escapechar=§,              % escape to latex with §...§
  upquote=true,                               % upright quotes
  aboveskip={1.5\baselineskip},               % a bit of space above listings
  columns=fixed,                              % nice spacing
  %
  % the following is for replacing some vhdl relations like >= or ~=
  % by the corresponding LaTeX symbols, which are much easier to read ...
  literate=%
    {~}{{$\neg$}}1 %            \neg
    % {-}{{-}}1 %                 prevent ``-'' being replaced by math minus
    {<=}{{\tiny$\leq$}}1 %      \leq
    {>=}{{\tiny$\geq$}}1 %      \geq
    {~=}{{\tiny$\neq$}}1 %      \neq
    {delta}{{\tiny$\Delta$}}1%  \Delta
    {iend}{{\fontfamily{pcr}\selectfont end}}3% end when indexing matrix elements
}

\begin{document}

Lorem ipsum \lstinline!x <= 0!.

\end{document}

Obviously, the behaviour is achived using the "literate" clause inside \lstset. However, in my case, I explicitly did not want the conversion, since it does not reflect the original syntax. The problem was that the code above was part of a .sty file which was included into my document. I wasn't aware of the things happening inside that .sty file, so I spent hours on researching how to suppress the conversion. When I found the file, it was a matter of seconds to remove the offending lines.

share|improve this answer
    
If you solved the problem, please accept your answer, so your question be removed from the "unanswered" pile. –  Jubobs Apr 8 at 18:21
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.