Jump to content

Partially working solution for importing latex generated pdf, help needed (OSX, Affinity Publisher)

Recommended Posts

I managed to have an almost working solution to produce a pdf from latex containing text and equations that can be placed / opened in Affinity Publisher (and probably in Designer too, untested) as editable text.

The example latex file `main.tex` needs to be compiled with lualatex (or xelatex, but pdflatex will not work), and requires the following OTF fonts:



I attach the produced file as `main_luatex.pdf`. Moreover, I opened the file with OSX Preview, and exported it as pdf with the name `main_exported.pdf`.


- main_luatex.pdf + open / place in Affinity Publisher doesn't work (missing characters, ...)

- main_exported.pdf + open / place in Affinity Publisher works as expected, text and equations are correctly imported as (editable) text

- opening main_luatex.pdf in OSX Preview, copying and pasting text to Affinity Publisher works but the exact placement of equations is lost (expected); copying and pasting a selection (Tools -> Rectangular Selection) works but it ignores the selection box and the whole page is copied instead (unexpected)

So, OSX Preview is doing something to the pdf but it's unclear what exactly.

So I tried running pdffonts on the 2 pdfs but the only difference is in the number of objects:

(base) ~/Downloads/tex
$ pdffonts main_luatex.pdf
name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
TIOITJ+LMRoman10-Regular             CID Type 0C       Identity-H       yes yes yes      4  0
ZVNSJQ+LatinModernMath-Regular       CID Type 0C       Identity-H       yes yes yes      5  0
ABULFO+LatinModernMath-Regular       CID Type 0C       Identity-H       yes yes yes      6  0
(base) ~/Downloads/tex
$ pdffonts main_exported.pdf
name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
VZLAKC+LMRoman10-Regular             CID Type 0C       Identity-H       yes yes yes      7  0
XSLNON+LatinModernMath-Regular       CID Type 0C       Identity-H       yes yes yes      8  0
ZQHZQC+LatinModernMath-Regular       CID Type 0C       Identity-H       yes yes yes      9  0

Moreover, while I can copy text from main_luatex.pdf and paste it correctly (equations aside of course) in an utf8-aware text editor, trying to do this  with main_exported.pdf results in unrecognized characters (the dreaded square boxes). Which adds to the mystery as this is the file can be correctly imported in Affinity Publisher!

Can someone with more expertise have a look at the 2 pdfs and explain what is the difference?

I am aware that all these issues can (to some extent) be avoided by making any pdf "fontless" (i.e. using ghostscript to convert fonts to curves) but I need to work with text in my workflow for a number of reasons.

In case there is a more relevant section in the forums please feel free to relocate this post as appropriate.




Edited by StephQ

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

Please note the Annual Company Closure section in the Terms of Use. These are the Terms of Use you will be asked to agree to if you join the forum. | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.