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



\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{fit}

\usepackage[active, tightpage]{preview}
\PreviewEnvironment{tikzpicture}

% taken from https://github.com/luhsra/texmf/blob/main/tex/latex/beamertools/beamertools.sty
\tikzset{
	onslide/.code args={<#1>#2}{%
		\only<#1>{\pgfkeysalso{#2}}
	},
	alt/.code args={<#1>#2#3}{%
		\alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}
	},
	global opacity/.style={
		opacity=#1,
		text opacity=#1,
		every shadow/.append style={opacity=#1},
		every on layer/.append style={opacity=#1},
		every node/.append style={opacity=#1},
		prefix after command={\pgfextra{\tikzset{every pin/.style={opacity=#1},
		every pin edge/.style={opacity=#1},
		every label/.style={opacity=#1}}}},
	},
	invisible/.style={global opacity=0},
	visible/.style={global opacity=1},
	visible on/.style={alt=#1{}{invisible}},
	invisible on/.style={alt=#1{invisible}{}},
}

\begin{document}
	\begin{frame}
		\begin{tikzpicture}
			\node[draw, visible on=<1>] (fp) {First Page};
			\node[draw, visible on=<2>] (sp) {Second Page};
			\node[draw, fit=(fp)(sp)] {};
		\end{tikzpicture}
	\end{frame}

\end{document}

Attachment: signature.asc
Description: This is a digitally signed message part.

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

Reply via email to