Re: insert listing so it can be copy/pasted from pdf

2019-05-06 Thread Guenter Milde
On 2019-05-06, Bob Alvarez wrote:

> [-- Type: text/plain, Encoding: quoted-printable --]


>>Which fonts does your PDF use?
> Here is what Pdf-Xchange viewer reported:

> CMSY9 (Embedded Subset)
> Type: Type 1 Encoding: Built-in Object Number: 5

> LMRomanlO-Regular (Embedded Subset)
> Type: Type 1 (CID) Encoding: Identity-H Object Number: 6

> LMRoman9- Regular (Embedded Subset)
> Type: Type 1 (CID) Encoding: Identity-H Object Number: 4

This looks good. (I get CM Roman instead of LM Roman with your
example but this should not have any influence on - and *.)

>>Is this with non-TeX fonts or with TeX fonts?
> Either one gives same result

>>Which output format?
> I tried several, luaTex and pdfLatex. All gave same problem.

I tested again with your example as well as the printable characters from 
Unicode Blocks Basic Latin and Latin-1 Supplement. The result when copying
back into text is:

 x−y
 
and

30 ! ” # $ % & ’
40 ( ) * + , − . / 0 1
50 2 3 4 5 6 7 8 9 : ;
60 < = > ? @ A B C D E
70 F G H I J K L M N O
80 P Q R S T U V W X Y
90 Z [ \ ] ^ _ ‘ a b c
100 d e f g h i j k l m
110 n o p q r s t u v w
120 x y z { | } ~

160
¡ ¢ £ ¤ ¥ ¦ §  ̈ ©
170 a « ¬ ®  ̄ ° ± 2 3
180  ́ μ ¶ ·  ̧ 1 o » 1⁄4 1⁄2
190 3⁄4 ¿ À Á Â Ã Ä Å Æ Ç
200 È É Ê Ë Ì Í Î Ï Ð Ñ
210 Ò Ó Ô Õ Ö × Ø Ù Ú Û
220 Ü Ý Þ ß à á â ã ä å
230 æ ç è é ê ë ì í î ï
240 ð ñ ò ó ô õ ö ÷ ø ù
250 ú û ü ý þ ÿ


So I expect this to be a problem of your PDF Viewer or clipboard or OS.

Could you try with another viewer?

With Postscript instead of PDF?

On a different computer?

Send the PDF as pm?

Günter



Re: insert listing so it can be copy/pasted from pdf

2019-05-06 Thread Bob Alvarez

>Which fonts does your PDF use?
Here is what Pdf-Xchange viewer reported:

CMSY9 (Embedded Subset)
Type: Type 1 Encoding: Built-in Object Number: 5

LMRomanlO-Regular (Embedded Subset)
Type: Type 1 (CID) Encoding: Identity-H Object Number: 6

LMRoman9- Regular (Embedded Subset)
Type: Type 1 (CID) Encoding: Identity-H Object Number: 4

>Is this with non-TeX fonts or with TeX fonts?
Either one gives same result

>Which output format?
I tried several, luaTex and pdfLatex. All gave same problem.



Re: insert listing so it can be copy/pasted from pdf

2019-05-06 Thread Guenter Milde
On 2019-05-06, Bob Alvarez wrote:

> [-- Type: text/plain, Encoding: quoted-printable --]

> Guenter and Joel

> I appreciate your help but I am coming to the conclusion that the pdf
> file format is not well enough defined to be able to reliably embed
> software listings that the reader can copy/paste into a file and then
> be able to compile the results.  I will have to continue as I have done
> in the past to include a listing in the pdf but also to provide a link
> to a supplementary online zip file with the source code in text files.

> Bob

> p.s.
> Guenter, here are the answers to some of the questions in your response:

>>Does it show up as hyphen or as question mark in the PDF?
> It is displayed as a '-' in the pdf but copy and paste of the 3 characters in 
> the listing results in x?y with '?' being 3F hex according to my editor.

OK this points to an encoding issue.

>>Which fonts does your PDF use?

> I do not know how to answer that question. How do I find out what fonts
> it uses?

In the "evince" PDF viewer, there is a menu entry "Properties" with a tab
"Fonts". Something similar should be possible with other viewers, too.

>>What is the result if your listing contains: ...

> Here is what I get if I enter your list into the listing, create a pdf
> then copy and paste the text in the listing.

> 30 ! " # $ % & '
> 40 ( ) ? + , ? . / 0 1
> 50 2 3 4 5 6 7 8 9 : ;
> 60 < = > ? @ A B C D E
> 70 F G H I J K L M N O
> 80 P Q R S T U V W X Y
> 90 Z [ \ ] ^ _ ` a b c
> 100 d e f g h i j k l m
> 110 n o p q r s t u v w
> 120 x y z { | } ~
> 160 ½¢¿¤¥¦?¨ c ?
> 170
> a ?¬­
> R ?¯°±²³
> 180 ´µ¶· ¹ o ?¼½
> 190 ¾¾ÀÁÂÃÄÅÆÇ
> 200 ÈÉÊËÌÍÎÏÐÑ
> 210 ÒÓÔÕÖ×ØÙÚÛ
> 220 ÜÝÞÿàáâãäå
> 230 æçèéêëìíîï
> 240 ðñòóôõö÷øù
> 250 úûüýþ¸

This looks not good: besides the "-", also "*" is mapped to "?".
And non-ASCII is even worse.

Is this with non-TeX fonts or with TeX fonts?
Which output format?

Günter



Re: insert listing so it can be copy/pasted from pdf

2019-05-06 Thread Bob Alvarez
Guenter and Joel

I appreciate your help but I am coming to the conclusion that the pdf file 
format is not well enough defined to be able to reliably embed software 
listings that the reader can copy/paste into a file and then be able to compile 
the results.  I will have to continue as I have done in the past to include a 
listing in the pdf but also to provide a link to a supplementary online zip 
file with the source code in text files.

Bob

p.s.
Guenter, here are the answers to some of the questions in your response:

>Does it show up as hyphen or as question mark in the PDF?
It is displayed as a '-' in the pdf but copy and paste of the 3 characters in 
the listing results in x?y with '?' being 3F hex according to my editor.

>Which fonts does your PDF use?
I do not know how to answer that question. How do I find out what fonts it uses?

>What is the result if your listing contains: ...
Here is what I get if I enter your list into the listing, create a pdf then 
copy and paste the text in the listing.

30 ! " # $ % & '
40 ( ) ? + , ? . / 0 1
50 2 3 4 5 6 7 8 9 : ;
60 < = > ? @ A B C D E
70 F G H I J K L M N O
80 P Q R S T U V W X Y
90 Z [ \ ] ^ _ ` a b c
100 d e f g h i j k l m
110 n o p q r s t u v w
120 x y z { | } ~
160 ½¢¿¤¥¦?¨ c ?
170
a ?¬­
R ?¯°±²³
180 ´µ¶· ¹ o ?¼½
190 ¾¾ÀÁÂÃÄÅÆÇ
200 ÈÉÊËÌÍÎÏÐÑ
210 ÒÓÔÕÖ×ØÙÚÛ
220 ÜÝÞÿàáâãäå
230 æçèéêëìíîï
240 ðñòóôõö÷øù
250 úûüýþ¸




Re: insert listing so it can be copy/pasted from pdf

2019-05-06 Thread Guenter Milde
On 2019-05-06, Bob Alvarez wrote:

>>>Does using "non-TeX" fonts in Document>Settings>Fonts help?(This
>>>allows all Unicode characters in listings and uses Unicode-encoded
>>>fonts in the output.)

> There was no change. The '-' character on the clipboard is still
> encoded as 3f hex.

Does it show up as hyphen or as question mark in the PDF?

Which fonts does your PDF use?

Maybe it is a lookalike character in the source?
Which character code do you get when copying from the LyX-GUI?

Are there similar problems with other characters in listings?
What is the result if your listing contains:

   30 ! " # $ % & '
   40 ( ) * + , - . / 0 1
   50 2 3 4 5 6 7 8 9 : ;
   60 < = > ? @ A B C D E
   70 F G H I J K L M N O
   80 P Q R S T U V W X Y
   90 Z [ \ ] ^ _ ` a b c
  100 d e f g h i j k l m
  110 n o p q r s t u v w
  120 x y z { | } ~

  160   ¡ ¢ £ ¤ ¥ ¦ § ¨ ©
  170 ª « ¬ ­ ® ¯ ° ± ² ³
  180 ´ µ ¶ · ¸ ¹ º » ¼ ½
  190 ¾ ¿ À Á Â Ã Ä Å Æ Ç
  200 È É Ê Ë Ì Í Î Ï Ð Ñ
  210 Ò Ó Ô Õ Ö × Ø Ù Ú Û
  220 Ü Ý Þ ß à á â ã ä å
  230 æ ç è é ê ë ì í î ï
  240 ð ñ ò ó ô õ ö ÷ ø ù
  250 ú û ü ý þ ÿ

> p.s. I copied the text at the bottom of my email and pasted into a text
> editor then saved as example2.lyx. When I tried to open it with my Lyx
> 2.1.3 I get a pop-up saying

> ...example2.lyx is not a readable LyX document.

> where ... is the path on my computer

Here, I was able to save the example from my text editor to a file, open it
in LyX and compile: 

Drag-and-drop from the PDF results in:

  x−y
  
With the - beeing the ASCII Character (45, 0x2D) 002D   HYPHEN-MINUS

Günter