[texworks] unwanted translation of ascii apostrophe in resulting pdf file

Stefan Löffler st.loeffler at gmail.com
Mon Mar 9 10:54:57 CET 2015

Hi Lorne,

this is not really a TeXworks question as TeXworks is only the
front-end. Your problem lies with LaTeX itself, so you might be better
off asking this question, e.g., on the texhax mailing list. Anyway, I
was curious about this, so I searched the internet a bit. Here's what I
came up with.

On 22.02.2015 02:14, Lorne Dudley wrote:
> Notice that in the resulting apostrophe.pdf
>     the second line apostrophe and the
>     apostrophes within the php code block appear different, but

They only appear different because they use different fonts. What LaTeX
apparently does is to try to make things typographically correct (i.e.,
"look beautiful"). In particular, this means that it alters all sorts of
quotation marks and apostrophes. BTW, this typically is

> Is there anyway to configure TexWorks so that the correct ascii 27
> code appears in the pdf document ???

Several way, apparently, all of which rely on the textcomp package to
produce the "correct" apostrophe.

First of all, there is already a great package out there to produce
source code listings which is called listings (duh). It should be
possible to configure it to produce unaltered apostrophes (see
http://tex.stackexchange.com/a/50535). However, this implies that you
can alter the way your tex file is generated (as it requires all source
code to be wrapped in \begin{lstlisting} ... \end{lstlisting}).

The second option is to replace all ' characters that should look
"normal" by {\textsinglequote}. Again, this requires altering the way
the tex file is produced (although probably much less than using the
listings package mentioned above).

The third option (or rather: hack) is the following (after


\catcode`' = 13


It changes the way ' is interpreted by LaTeX. Beware that this applies
not only to the source code parts of your document, but to all of your
document. So you won't be able to produce typographical quotation marks,
for instance, and there may be other side-effects as well.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/texworks/attachments/20150309/e1a4260e/attachment.html>

More information about the texworks mailing list