racket-poppler
racket-poppler copied to clipboard
raco setup fails
I tried to install your package and got this:
% raco pkg install racket-poppler
.....
.....
raco setup: 0 running:
raco setup: --- installing collections ---
I am on Mac OS X 10.7+++. Let me know whether you need anything else.
I have fixed the symptom: raco setup no longer complains there is a missing main.scrbl. Fixing the underlying problem i.e. actually writing some documentation will take a little longer.
There are some examples though:
An example of rendering tex: https://github.com/soegaard/racket-poppler/blob/master/test-render-tex.rkt
Other: https://github.com/soegaard/racket-poppler/tree/master/racket-poppler/examples
Wilbers documentation of the old api is here: file:///Users/soegaard/Dropbox/GitHub/racket-poppler/racket-poppler/doc/index.html
2014-08-23 15:05 GMT+02:00 Matthias Felleisen [email protected]:
I am on Mac OS X 10.7+++. Let me know whether you need anything else.
I'd like to know if test-render-tex works for you.
https://github.com/soegaard/racket-poppler/blob/master/test-render-tex.rkt
/Jens Axel
No. Here is the output:
Language: racket.
INFO: generating latex2pdf-46636ca676a76b15c638d1e13223f58e.pdf
INFO: /usr/local/texlive/2012/bin/x86_64-darwin/latex -interaction=batchmode -file-line-error -halt-on-error latex2pdf-46636ca676a76b15c638d1e13223f58e.tex
INFO: loading latex2pdf-46636ca676a76b15c638d1e13223f58e.pdf
. . pdf-page: contract violation
expected: pdf?
given: #f
in: the 1st argument of
(->
pdf?
exact-nonnegative-integer?
(or/c page? #f))
contract from:
(Nothing urgent on my side. I use my own library for latexing inside of Scribble.)
I got the same error that @mfelleisen was getting...
I think I found the problem. The generated LaTeX has the following line:
\usepackage[active,tightpage,pdftex]{preview}
However, this will not generate any page (see http://tex.stackexchange.com/questions/146511/using-usepackageactive-tightpagepreview-does-not-generate-any-page). Changing the line to
\usepackage[active,tightpage,pdftex,textmath]{preview}
will generate the file properly, although I'm not sure if this is what you actually want or not.
Hi @sorawee and @mfelleisen
I have committed a fix.
Note: I tested on a newly installed version of TexLive 2015 on OS X El Capitan. I don't know if it changes anything, but prior to finding the fix, I updated the LaTeX classes/packages "standalone" and "preview" like this:
sudo tlmgr update standalone
sudo tlmgr update preview
... contract violation expected: pdf?
The issue with empty PDFs still persists. Configuration: Windows 10, TeX Live 2022.
That's surprising to me. I am using TexLive 2019 on my current system.
What's the contents of the generated TeX file?
After booting my Windows computer, I got the following working on Racket 8.4 and with TexLive 2020. Note that any problem with the LaTeX results in an empty pdf. To see the LaTeX log, simply insert
(latex-debug? #t)
when you run into an empty pdf.
If pdflatex
is in the Windows search path, I think Poppler picks it up automatically,
but if not you can use latex-path
to set it manually - see below.
Finally, if you are using DrRacket: convert the picts to bitmap to see them in the repl. [There is no problems with saving picts as svg or pdf - it's just the way the repl in DrRacket is implemented that makes the conversion to bitmap necesssary.]
#lang racket
(require latex-pict pict racket-poppler/render-tex)
(latex-debug? #t)
(latex-path
(case (system-type)
[(windows) "c:/texlive/2020/bin/win32/pdflatex.exe"]))
; make a Racket pict from a piece of TeX
(define p (tex-math "\\sqrt{x^2+y^2+z}"))
(pict->bitmap p)
(define beside hc-append)
(define above vc-append)
(pict->bitmap ; pict->bitmap is need in DrRacket
; DrRacket won't display picts that draw directly
; to the Cairo drawing context
; This shows that the pict can be used as a normal pict.
(above (beside (rotate p (- pi (/ pi 3))) (rotate p (/ pi 3)))
(beside (rotate p (+ pi (/ pi 3))) (rotate p (- (/ pi 3))))))
(pict->bitmap p)
(define (tex s) (pict->bitmap (inset (tex-math s) 4)))
This works indeed, and produces the following tex:
\documentclass{standalone}
\usepackage[active,tightpage,lyx,pdftex,textmath]{preview}
\begin{document}
\(\sqrt{x^2+y^2+z}\)
\end{document}
This: (latex->pict "$\\sqrt{x^2+y^2}$" #:preamble #f)
(as recommended by https://github.com/formalizm/racket-poppler/blob/master/README.md), however, doesn't work, as it produces the following tex:
\documentclass{standalone}
\usepackage[active,tightpage,lyx,pdftex]{preview}
\begin{document}
$\sqrt{x^2+y^2}$
\end{document}
As I understood after some investigation, TeX package preview
changed many years ago to skip $-math not enclosed in \begin{preview}
... \end{preview}
.
P.S. Obviously at certain point #:preamble
became by mistake a mandatory function argument.