Transparency in external PDFs does not work
Hi, I'm using LaTeX-Beamer and TikZ for figure typesetting. With this combination, it is easy to combine Beamer's animation system with TikZ transparency feature. This way, the resulting PDFs contain the full graphic on every page, but parts of it are invisible for a specific page. One of these files is attached as an example. The problem is to embed these PDFs into a ConTeXt document. For example, this MWE seems to not respect transparency (see mwe.pdf): ``` \starttext \externalfigure[fig.pdf][page=1] \stoptext ``` I use Okular/Poppler as PDF viewer. Can I fix this somehow or is it a bug somewhere deeper? Best Gerion
On 6/17/24 17:07, Gerion Entrup wrote:
[...] I use Okular/Poppler as PDF viewer. Can I fix this somehow or is it a bug somewhere deeper?
Hi Gerion, I can confirm your issue. It seems to be an issue with LMTX. LuaTeX has no problem with the file. Just in case it helps, Pablo
On 6/17/2024 5:07 PM, Gerion Entrup wrote:
Hi,
I'm using LaTeX-Beamer and TikZ for figure typesetting. With this combination, it is easy to combine Beamer's animation system with TikZ transparency feature. This way, the resulting PDFs contain the full graphic on every page, but parts of it are invisible for a specific page. One of these files is attached as an example.
The problem is to embed these PDFs into a ConTeXt document. For example, this MWE seems to not respect transparency (see mwe.pdf): ``` \starttext \externalfigure[fig.pdf][page=1] \stoptext ```
I use Okular/Poppler as PDF viewer. Can I fix this somehow or is it a bug somewhere deeper? next time check the file that you include ... it has no transparency (it has zero values)
the attached works ok Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
Am Montag, 17. Juni 2024, 23:50:16 MESZ schrieb Hans Hagen:
On 6/17/2024 5:07 PM, Gerion Entrup wrote:
Hi,
I'm using LaTeX-Beamer and TikZ for figure typesetting. With this combination, it is easy to combine Beamer's animation system with TikZ transparency feature. This way, the resulting PDFs contain the full graphic on every page, but parts of it are invisible for a specific page. One of these files is attached as an example.
The problem is to embed these PDFs into a ConTeXt document. For example, this MWE seems to not respect transparency (see mwe.pdf): ``` \starttext \externalfigure[fig.pdf][page=1] \stoptext ```
I use Okular/Poppler as PDF viewer. Can I fix this somehow or is it a bug somewhere deeper? next time check the file that you include ... it has no transparency (it has zero values)
I don't really have a clue about the PDF standard. It is made with the TikZ opacity flag therefore I thought it controls the transparency. See the attached tex file to reproduce fig.pdf (compilation with `latexmk -pdflua fig.tex`). I also found a workaround. It is possible to import fig.pdf with Inkscape and export just the correct page as PDF again and embed that in ConTeXt: ``` inkscape --export-page=1 fig.pdf --export-type=pdf --export-filename=1.pdf ``` Gerion
On 6/18/2024 9:54 AM, Gerion Entrup wrote:
Am Montag, 17. Juni 2024, 23:50:16 MESZ schrieb Hans Hagen:
On 6/17/2024 5:07 PM, Gerion Entrup wrote:
Hi,
I'm using LaTeX-Beamer and TikZ for figure typesetting. If you use that kind of simple graphics, you can avoid this transparency hacking by using metafun:
\setupbodyfont[dejavu] \starttext \startuseMPgraphic{test} pickup pencircle scaled 2mm ; draw fullcircle scaled 3cm withcolor darkred withstacking 1 ; draw fullcircle scaled 2cm withcolor darkblue withstacking 2 ; draw textext("one") withcolor darkgreen withstacking 11 ; draw textext("two") withcolor darkgreen withstacking 12 ; draw textext("three") withcolor darkgreen withstacking 13 ; \stopuseMPgraphic \startTEXpage[offset=.25ts] \useMPgraphic{test}{stacking={1,11}} \stopTEXpage \startTEXpage[offset=.25ts] \useMPgraphic{test}{stacking={2,12}} \stopTEXpage \startTEXpage[offset=.25ts] \useMPgraphic{test}{stacking={1,2,13}} \stopTEXpage \stoptext It's an already old feature but probably not that well known. If needed I can make something similar at the tex end. Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
Am Mittwoch, 19. Juni 2024, 09:50:33 MESZ schrieb Hans Hagen:
On 6/18/2024 9:54 AM, Gerion Entrup wrote:
Am Montag, 17. Juni 2024, 23:50:16 MESZ schrieb Hans Hagen:
On 6/17/2024 5:07 PM, Gerion Entrup wrote:
Hi,
I'm using LaTeX-Beamer and TikZ for figure typesetting. If you use that kind of simple graphics, you can avoid this transparency hacking by using metafun:
\setupbodyfont[dejavu]
\starttext
\startuseMPgraphic{test} pickup pencircle scaled 2mm ; draw fullcircle scaled 3cm withcolor darkred withstacking 1 ; draw fullcircle scaled 2cm withcolor darkblue withstacking 2 ; draw textext("one") withcolor darkgreen withstacking 11 ; draw textext("two") withcolor darkgreen withstacking 12 ; draw textext("three") withcolor darkgreen withstacking 13 ; \stopuseMPgraphic
\startTEXpage[offset=.25ts] \useMPgraphic{test}{stacking={1,11}} \stopTEXpage
\startTEXpage[offset=.25ts] \useMPgraphic{test}{stacking={2,12}} \stopTEXpage
\startTEXpage[offset=.25ts] \useMPgraphic{test}{stacking={1,2,13}} \stopTEXpage
\stoptext
It's an already old feature but probably not that well known. If needed I can make something similar at the tex end.
Hans
Thank you for the example, but learning metafun is another chapter and the graphics are much more complicated than the minimal example given. I saw that you pushed an updated version that fixes the bug [1]. Thank you! Gerion [1] https://github.com/contextgarden/context/commit/0bcdd3ce47a406ed7852724504e3...
On 6/21/2024 2:41 PM, Gerion Entrup wrote:
Am Mittwoch, 19. Juni 2024, 09:50:33 MESZ schrieb Hans Hagen:
On 6/18/2024 9:54 AM, Gerion Entrup wrote:
Am Montag, 17. Juni 2024, 23:50:16 MESZ schrieb Hans Hagen:
On 6/17/2024 5:07 PM, Gerion Entrup wrote:
Hi,
I'm using LaTeX-Beamer and TikZ for figure typesetting. If you use that kind of simple graphics, you can avoid this transparency hacking by using metafun:
\setupbodyfont[dejavu]
\starttext
\startuseMPgraphic{test} pickup pencircle scaled 2mm ; draw fullcircle scaled 3cm withcolor darkred withstacking 1 ; draw fullcircle scaled 2cm withcolor darkblue withstacking 2 ; draw textext("one") withcolor darkgreen withstacking 11 ; draw textext("two") withcolor darkgreen withstacking 12 ; draw textext("three") withcolor darkgreen withstacking 13 ; \stopuseMPgraphic
\startTEXpage[offset=.25ts] \useMPgraphic{test}{stacking={1,11}} \stopTEXpage
\startTEXpage[offset=.25ts] \useMPgraphic{test}{stacking={2,12}} \stopTEXpage
\startTEXpage[offset=.25ts] \useMPgraphic{test}{stacking={1,2,13}} \stopTEXpage
\stoptext
It's an already old feature but probably not that well known. If needed I can make something similar at the tex end.
Hans
Thank you for the example, but learning metafun is another chapter and the graphics are much more complicated than the minimal example given.
I saw that you pushed an updated version that fixes the bug [1]. Thank you!
Gerion
[1] https://github.com/contextgarden/context/commit/0bcdd3ce47a406ed7852724504e3... The next upload will have an example of something similar at the \TEX\ end (i made it a few days ago but no upload yet). An exmaple can (then) be found in:
stacking-001.tex in the test suite. Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
participants (4)
-
Gerion Entrup
-
Hans Hagen
-
Hans Hagen
-
Pablo Rodriguez