Insert a PDF paragraph (from LaTeX) in a cell

7

2

I need to insert a PDF paragraph (from LaTeX) in a cell. I realized that the option "Insert file" does not work with PDF text.

Because I need resize the paragraph without quality loss, PNG image is not an option. So, my strategy is: Convert PDF to SVG with pdf2svg (Ubuntu's program)

pdf2svg pba.pdf  SALIDA%d.svg all

and text is converted to outlines, and after I save it in PDF format. The result is good and I can edit and make some adjusts with Drawing Tools.

enter image description here

But it no seems very efficent procedure. Is there another way to do it?

wmora2

Posted 2016-11-02T17:06:51.393

Reputation: 399

You could post that update as a self-answer (if you like). – Szabolcs – 2018-01-03T19:30:01.073

Answers

7

Mathematica always outlines text when Importing PDF as Graphics. There's no way around that. Update: There is the "TextOutlines" option, as Alexey notes in a comment below.

Some PDF files are not imported correctly by Mathematica. There can be multiple reasons for this. We would have to see your PDF file to see why it doesn't import correctly.

If the reason is indeed fonts, you can outline fonts using Ghostscript 9.15 or later. Example command line:

gs -o out.pdf -dNoOutputFonts -sDEVICE=pdfwrite in.pdf

I use this in MaTeX.

Szabolcs

Posted 2016-11-02T17:06:51.393

Reputation: 213 047

Thanks, I've tried your command line code and it works, I used the new PDF and I've been able to import the pdf without problems. To my purposes, the outlines text it's oK. I have also tried matex, and it is excellent for my purposes. Sincerely, thanks a lot – wmora2 – 2016-11-03T01:47:40.853

1"Mathematica always outlines text when Importing PDF as Graphics." - this isn't correct: try Import[fileName, "PDF", "TextOutlines" -> False]. For importing ASCII text it usually works nicely. – Alexey Popkov – 2017-04-30T12:44:37.713

Ok, I already did – wmora2 – 2018-01-03T19:49:49.077

2

I use the tcolorbox package to work with paragraphs, examples, definitions, theorems, etc. Example:

enter image description here

<< MaTeX`
SetOptions[MaTeX, 
  "Preamble" -> {"\\usepackage[most,listings]{tcolorbox}", 
    "\\tcbset{colframe=white}"}];
MaTeX["\\mbox{\\begin{tcolorbox}[colback=white]
 Esta es una prueba con el paquete {\\tt tcolorbox }\\\\

 $f(x)=\\left\\{\\begin{array}{rcl}
 x^2       &si& x>0\\\\ \\\\
 \\sin x   &si& x<0
 \\end{array}\\right.
 $\\end{tcolorbox}}", Magnification -> 1.5]

wmora2

Posted 2016-11-02T17:06:51.393

Reputation: 399