LyXhyperref listings apostrophe conflict

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
jgthb
Posts: 13
Joined: Wed Feb 17, 2010 6:57 pm

hyperref listings apostrophe conflict

Post by jgthb »

Hi there

I have a lyx document with hyperref turned on, and where the only text in the document is the following ERT:

\lstinputlisting{Matlab/chaseExample.m}

In the file chaseExample.m I have the following lines:

pos =
'beginning';

(and some other lines too) and it seems like the apostrophe causes the problem, when I compile:

! LaTeX Error: Command \textquotesingle unavailable in encoding T1.

'
beginning';
Your command was ignored.
Type I <command> <return> to replace it with another command,
or <return> to continue without it.

If I turn hyperref off, it seems to work, but I don't really want to do that. Can anyone help?

// Jonathan

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX books
jgthb
Posts: 13
Joined: Wed Feb 17, 2010 6:57 pm

Re: hyperref listings apostrophe conflict

Post by jgthb »

I have solved it. I forgot to say, that I also use the command
\usepackage[numbered,framed]{mcode}
which makes Matlab-code look nice, when using the command
\lstinputlisting{}

At
http://www.mathworks.com/matlabcentral/ ... ange/8015/
a commenter mentioned the package 'textcomp' (which makes extra symbols available from what I understand) and by simply adding this it suddenly worked.

The package did however introduce a new problem, namely that some hyphens ('-') suddenly caused an error. Apparently sometimes when text with a hyphen is copied from a pdf-file a long hyphen is inserted into the document, but is seems like the package textcomp has a problem with that, so I had to replace the long ones with standard short ones (the one on the keyboard).

It seems like all things work now :)
Post Reply