[XeTeX] xelatex to doc?

Hueckstedt, Robert A. (rah2k) rah2k at virginia.edu
Mon Feb 5 21:54:27 CET 2018

Thank you all for your help with this matter. The answer, as many have already pointed out, is simply to add the line


To the preamble of the header file. Then, as the publisher has assured me, all the Sanskrit in Devanagari can be copied out of the pdf file and pasted into doc, etc. to one’s heart’s content.

Bob Hueckstedt

From: XeTeX [mailto:xetex-bounces at tug.org] On Behalf Of Zdenek Wagner
Sent: Wednesday, January 31, 2018 5:19 AM
To: XeTeX (Unicode-based TeX) discussion. <xetex at tug.org>
Subject: Re: [XeTeX] xelatex to doc?

No, neither make4ht nor Acrobat Pro helps. The reason is that generated PDF contains glyphs but both copy&paste, save as text, save as word, or sace as whatever requires characters and this information is lost. Moreover, the order of glyphs does not follow the order of characters in the word. It can only be solved by asking XeTeX to add /ActualText as a Unicode string to each word and, of course, use a PDF viewer that does not ignore it. Adobe Reader is sufficient. The extracted string then contains Unicode characters and conversion to glyphs is then done by MS Word shaping engine (Uniscribe).
Note: see the well known name Siddhartha where dependent vowel (matra) I is visually at the very beginning and R is visually at the very end.

Zdeněk Wagner

2018-01-31 1:49 GMT+01:00 Ross Moore <ross.moore at mq.edu.au<mailto:ross.moore at mq.edu.au>>:
Hi Robert and Michal,

On Jan 31, 2018, at 8:29 AM, Michal Hoftich <michal.h21 at gmail.com<mailto:michal.h21 at gmail.com>> wrote:

Hi Bob,

On Tue, Jan 30, 2018 at 6:57 PM, Hueckstedt, Robert A. (rah2k)
<rah2k at virginia.edu<mailto:rah2k at virginia.edu>> wrote:

With a publisher’s permission I used xelatex to provide them copy, not
camera-ready copy, for a long book that has Sanskrit in Devanagari  and an
English translation. Of course, the files I provided the publisher are pdfs.
Now, the publisher wants them in doc. When they try to cut and paste from
the pdf to doc, none of the conjunct consonants are recognized in the doc
file. I used the velthuis-sanskrit mapping, and I am wondering if using the
RomDev mapping would make a difference. I somehow doubt it. Suggestions?

You can try to compile your TeX file to HTML using tex4ht. The HTML
code can be then pasted to Word. Basic command to compile XeTeX file
to HTML is

  make4ht -ux filename.tex

This might work, but first I’d try using Acrobat Pro to save the PDF
directly into a Word document.

This *can* work really well, especially when the PDF is enriched with
some tagging and the correct ToUnicode CMap resources for the fonts.
Try it and see if the result is reasonable.

Alternatively, you can Export to HTML from Acrobat Pro; though I’d
expect that if the .doc export is no good, then the HTML export would
suffer from similar issues.

It may even be that Adobe Reader can do these exports now,
as it is the same code-base.

Development version of make4ht can compile also to the ODT format,
which can be opened directly in Word:

  make4ht -ux -f odt filename.tex

It is possible that you will need some additional configurations for
the correct compilation. It depends on used packages or custom macros
in the document.

Best regards,

Hope this helps.


PS. if you don’t have access to Acrobat Pro to try this,
can you send me a few pages. I’ll then try it for you.
If the result is good, that may be sufficient reason for you
to consider investing in a license.

Dr Ross Moore
Mathematics Dept | 12 Wally’s Walk, 734
Macquarie University, NSW 2109, Australia
T: +61 2 9850 8955<tel:+61%202%209850%208955>  |  F: +61 2 9850 8114<tel:+61%202%209850%208114>
M:+61 407 288 255<tel:+61%20407%20288%20255>  |  E: ross.moore at mq.edu.au<mailto:ross.moore at mq.edu.au>


[cid:image001.png at 01D39E99.99EFF0A0]<http://mq.edu.au/>

CRICOS Provider Number 00002J. Think before you print.
Please consider the environment before printing this email.

This message is intended for the addressee named and may
contain confidential information. If you are not the intended
recipient, please delete it and notify the sender. Views expressed
in this message are those of the individual sender, and are not
necessarily the views of Macquarie University.

Subscriptions, Archive, and List information, etc.:

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/xetex/attachments/20180205/9acf8f1b/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 4605 bytes
Desc: image001.png
URL: <http://tug.org/pipermail/xetex/attachments/20180205/9acf8f1b/attachment-0001.png>

More information about the XeTeX mailing list