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

Lorne Dudley dudleyl at queensu.ca
Sun Feb 22 02:14:16 CET 2015


I have attached a simple test case and resulting files demonstrating the 
problem.

Software used is
python 2.7.9
TexWorks 0.4.5 r1280 (MiKTeX 2.9)

apostrophe.rst is the start point.

C:\Python27\Scripts> python rst2html.py apostrophe.rst apostrophe.html

apostrophe.html displays correctly.

C:\Python27\Scripts> python rst2latex.py apostrophe.rst apostrophe.tex
(note that apostrophe.tex still contains unmodified apostrophes)

open apostrophe.tex in TexWorks

Typeset pdfLaTex

apostrophe.pdf is produced

Notice that in the resulting apostrophe.pdf
     the second line apostrophe and the
     apostrophes within the php code block appear different, but

  In each case, if the resulting "apostrophe" is cut and pasted into an 
ascii based text editor, the result is
an ascii character with hex code 92 rather than the original ascii hex 
code 27 character.

This causes great problems for people who like to cut and paste code 
examples from a tutorial pdf document.

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

Regards

Lorne Dudley
Kingston, Ontario
Canada


----- configuration info -----
TeXworks version : 0.4.5r1280 (MiKTeX 2.9)
Install location : C:/Program Files/MiKTeX 
2.9/miktex/bin/miktex-texworks.exe
Library path : C:/Users/RedFox/AppData/Local/MiKTeX/2.9/TeXworks/0.4\
pdfTeX location : C:/Program Files/MiKTeX 2.9/miktex/bin/pdftex.exe
Operating system : Windows Microsoft Windows 7 Home Premium Edition, 
32-bit Service Pack 1 (build 7601)
Qt4 version : 4.8.4 (build) / 4.8.4 (runtime)
------------------------------

-------------- next part --------------
TexWorks Apostrophe Alteration
##############################

Example of alteration of ' (apostrophe)
=======================================

APOSTROPHE is hex code 27 in both ascii and utf-8.

.. code-block:: php

    // app/Model/User.php
    App::uses('AppModel', 'Model');

    class User extends AppModel {
        public $validate = array(
            'username' => array(
                'required' => array(
                    'rule' => array('notEmpty'),
                    'message' => 'A username is required'
                )
            ),
            'password' => array(
                'required' => array(
                    'rule' => array('notEmpty'),
                    'message' => 'A password is required'
                )
            ),
            'role' => array(
                'valid' => array(
                    'rule' => array('inList', array('admin', 'author')),
                    'message' => 'Please enter a valid role',
                    'allowEmpty' => false
                )
            )
        );
    }

End of apostrophe alteration example.
-------------------------------------

.. meta::
    :title lang=en: TexWorks Apostrophe Alteration
    :keywords lang=en: texworks,latex,apostrophe alteration
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/texworks/attachments/20150221/650c9506/attachment-0001.html>
-------------- next part --------------
\documentclass[a4paper]{article}
% generated by Docutils <http://docutils.sourceforge.net/>
\usepackage{fixltx2e} % LaTeX patches, \textsubscript
\usepackage{cmap} % fix search and cut-and-paste in Acrobat
\usepackage{ifthen}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{color}
\setcounter{secnumdepth}{0}

%%% Custom LaTeX preamble
% PDF Standard Fonts
\usepackage{mathptmx} % Times
\usepackage[scaled=.90]{helvet}
\usepackage{courier}

%%% User specified packages and stylesheets

%%% Fallback definitions for Docutils-specific commands
% basic code highlight:
\providecommand*\DUrolecomment[1]{\textcolor[rgb]{0.40,0.40,0.40}{#1}}
\providecommand*\DUroledeleted[1]{\textcolor[rgb]{0.40,0.40,0.40}{#1}}
\providecommand*\DUrolekeyword[1]{\textbf{#1}}
\providecommand*\DUrolestring[1]{\textit{#1}}

% subtitle (in document title)
\providecommand*{\DUdocumentsubtitle}[1]{{\large #1}}

% inline markup (custom roles)
% \DUrole{#1}{#2} tries \DUrole#1{#2}
\providecommand*{\DUrole}[2]{%
  \ifcsname DUrole#1\endcsname%
    \csname DUrole#1\endcsname{#2}%
  \else% backwards compatibility: try \docutilsrole#1{#2}
    \ifcsname docutilsrole#1\endcsname%
      \csname docutilsrole#1\endcsname{#2}%
    \else%
      #2%
    \fi%
  \fi%
}

% hyperlinks:
\ifthenelse{\isundefined{\hypersetup}}{
  \usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
  \urlstyle{same} % normal text font (alternatives: tt, rm, sf)
}{}
\hypersetup{
  pdftitle={TexWorks Apostrophe Alteration},
}

%%% Title Data
\title{\phantomsection%
  TexWorks Apostrophe Alteration%
  \label{texworks-apostrophe-alteration}%
  \\ % subtitle%
  \DUdocumentsubtitle{Example of alteration of ' (apostrophe)}%
  \label{example-of-alteration-of-apostrophe}}
\author{}
\date{}

%%% Body
\begin{document}
\maketitle

APOSTROPHE is hex code 27 in both ascii and utf-8.
%
\begin{quote}{\ttfamily \raggedright \noindent
\DUrole{other}{//~app/Model/User.php\\
App::uses('AppModel',~'Model');\\
~\\
class~User~extends~AppModel~\{\\
~~~~public~\$validate~=~array(\\
~~~~~~~~'username'~=>~array(\\
~~~~~~~~~~~~'required'~=>~array(\\
~~~~~~~~~~~~~~~~'rule'~=>~array('notEmpty'),\\
~~~~~~~~~~~~~~~~'message'~=>~'A~username~is~required'\\
~~~~~~~~~~~~)\\
~~~~~~~~),\\
~~~~~~~~'password'~=>~array(\\
~~~~~~~~~~~~'required'~=>~array(\\
~~~~~~~~~~~~~~~~'rule'~=>~array('notEmpty'),\\
~~~~~~~~~~~~~~~~'message'~=>~'A~password~is~required'\\
~~~~~~~~~~~~)\\
~~~~~~~~),\\
~~~~~~~~'role'~=>~array(\\
~~~~~~~~~~~~'valid'~=>~array(\\
~~~~~~~~~~~~~~~~'rule'~=>~array('inList',~array('admin',~'author')),\\
~~~~~~~~~~~~~~~~'message'~=>~'Please~enter~a~valid~role',\\
~~~~~~~~~~~~~~~~'allowEmpty'~=>~false\\
~~~~~~~~~~~~)\\
~~~~~~~~)\\
~~~~);\\
\}}
}
\end{quote}


\section{End of apostrophe alteration example.%
  \label{end-of-apostrophe-alteration-example}%
}

\end{document}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: apostrophe.pdf
Type: application/pdf
Size: 43970 bytes
Desc: not available
URL: <http://tug.org/pipermail/texworks/attachments/20150221/650c9506/attachment-0001.pdf>


More information about the texworks mailing list