[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [patch] Add two new header args to LaTeX block
From: |
Juan Manuel Macías |
Subject: |
Re: [patch] Add two new header args to LaTeX block |
Date: |
Sat, 10 Feb 2024 23:34:51 +0000 |
Ihor Radchenko writes:
> Juan Manuel Macías <maciaschain@posteo.net> writes:
>
>> I am attaching a new patch with this idea incorporated. I have also
>> changed the name from full-to-pdf to standalone.
>>
>> + (process (cdr (assq :process params)))
>> + (org-preview-latex-default-process (if (and process
>> + (string-suffix-p
>> ".png" out-file)
>> + (not imagemagick))
>
> Considering that 'imagemagick is one of the variants in
> `org-preview-latex-process-alist', it might be reasonable to allow
> :process imagemagick == :imagemagick yes
I wouldn't equate it. ':imagemagic yes' uses 'org-latex-convert-pdf'.
Instead, «:process 'imagemagick» depends on:
(imagemagick :programs
("latex" "convert")
:description "pdf > png"
:message "you need to install the programs: latex and
imagemagick."
:image-input-type "pdf"
:image-output-type "png"
:image-size-adjust (1.0 . 1.0)
:latex-compiler ("pdflatex -interaction nonstopmode
-output-directory %o %f")
:image-converter ("convert -density %D -trim -antialias %f
-quality 100 %O"))
Also, one may want to put «:imagemagick yes» and compile the PDF
with another compiler or with a custom script:
:imagemagick yes :process '(...)
> Also, it feels incomplete to be able to define latex command for :file
> foo.pdf, but be limited to a pre-defined list of symbols for :file .png.
The ".png" method without ":imagemagick" does not depend on
'org-latex-pdf-process' but on 'org-create-formula-image', and this in turn
depends on the value of 'org-preview-latex-default-process':
...
((and (string-suffix-p ".png" out-file) (not imagemagick))
(let ((org-format-latex-header
(concat org-format-latex-header "\n"
(mapconcat #'identity headers "\n"))))
(org-create-formula-image
body out-file org-format-latex-options in-buffer)))
...
If you put :file foo.png without :imagemagick, and want to control the
process or change the compiler, you can do it with:
:process '(foo :latex-compiler ("some LaTeX command"))
since this syntax is what org-preview-latex-default-process expects.
In all other cases, including :imagemagick, the compilation process
depends on the value of org-latex-pdf-process.
Anyway, I don't understand why that feature option (convert to an image
without :imagemagick method) is limited to .png, when other graphic files are
possible. I can define something like this:
(setq org-preview-latex-default-process
'(my-process
:programs ("lualatex" "convert")
:description "pdf > jpg"
:image-input-type "pdf"
:image-output-type "jpg"
:latex-compiler ("lualatex -interaction nonstopmode -output-directory
%o %f")
:image-converter ("convert -density %D -trim -antialias %f -quality 100
%O")))
But if I put :file foo.jpg nothing happens. Maybe that part should be
corrected... Something like (string-match-p "\\.png\\|\\.jpg\\|..." out-file)?
Best regards,
Juan Manuel
--
Juan Manuel Macías -- Composición tipográfica, tratamiento de datos, diseño
editorial y ortotipografía
- [patch] Add two new header args to LaTeX block, Juan Manuel Macías, 2024/02/09
- Re: [patch] Add two new header args to LaTeX block, Ihor Radchenko, 2024/02/10
- Re: [patch] Add two new header args to LaTeX block, Juan Manuel Macías, 2024/02/10
- Re: [patch] Add two new header args to LaTeX block, Ihor Radchenko, 2024/02/10
- Re: [patch] Add two new header args to LaTeX block, Juan Manuel Macías, 2024/02/10
- Re: [patch] Add two new header args to LaTeX block, Juan Manuel Macías, 2024/02/10
- Re: [patch] Add two new header args to LaTeX block, Ihor Radchenko, 2024/02/10
- Re: [patch] Add two new header args to LaTeX block,
Juan Manuel Macías <=
- Re: [patch] Add two new header args to LaTeX block, Ihor Radchenko, 2024/02/11
- Re: [patch] Add two new header args to LaTeX block, Juan Manuel Macías, 2024/02/11
- Re: [patch] Add two new header args to LaTeX block, Ihor Radchenko, 2024/02/13
- Re: [patch] Add two new header args to LaTeX block, Juan Manuel Macías, 2024/02/13
- Re: [patch] Add two new header args to LaTeX block, Ihor Radchenko, 2024/02/18
- Re: [patch] Add two new header args to LaTeX block, Juan Manuel Macías, 2024/02/18
- Re: [patch] Add two new header args to LaTeX block, Ihor Radchenko, 2024/02/19
- Re: [patch] Add two new header args to LaTeX block, Juan Manuel Macías, 2024/02/19