如何在 \special for dvi -> ps -> pdf 中使用專色?

如何在 \special for dvi -> ps -> pdf 中使用專色?

我有一堆使用picture環境的老人物。為了編譯這些數字,我必須使用dvi->dvips->ps2pdf工具鏈。

我需要將這些圖片中的顏色從rgb模型顏色變更為cmyk潘通顏色。使用中的答案這個問題,我設法定義專色。我的問題是,如果我直接在\special巨集中使用它,pdf檢視器(evince)將其顯示為黑色。

我該如何告訴 dvips 使用定義的專色?

微量元素

\begin{filecontents*}{spot_color.pro}
TeXDict begin
/RedSpotCMYK [0 1 0 0] def
/RedSpotSpot (RedSpot) def
/RedSpotDef RedSpotCMYK aload pop RedSpotSpot findcmykcustomcolor def
/XC@RedSpot{RedSpotDef 1.0 setcustomcolor}XCdef
end
\end{filecontents*}

\documentclass{minimal}
\usepackage[prologue]{xcolor}

\usepackage[tightpage,active,psfixbb]{preview}
\setlength\PreviewBorder{2mm}
\PreviewEnvironment{picture}

\definecolor{RedSpot}{cmyk}{0 1 0 0}

\usepackage{eepic}

\begin{document}
\setlength{\unitlength}{0.254mm}
\begin{picture}(340,225)(100,-420)
  % This compiles but arrow shows black
  \special{RedSpot 1}\allinethickness{0.508mm}\path(110,-395)(170,-300)\special{sh 1}\path(170,-300)(167,-302)(168,-303)(169,-304)(170,-300) % Plain Solid Arrow
  % This has compilation error:
  % ps2pdf spotcolor-picture.ps
  % Error: /undefined in TeXcolorRedSpot
  % \special{color RedSpot 1}\allinethickness{0.508mm}\path(110,-395)(170,-300)\special{sh 1}\path(170,-300)(167,-302)(168,-303)(169,-304)(170,-300) % Plain Solid Arrow
  % With the CMYK model it shows correctly
  %  \special{color cmyk 0 1 0 0}\allinethickness{0.508mm}\path(110,-395)(170,-300)\special{sh 1}\path(170,-300)(167,-302)(168,-303)(169,-304)(170,-300) % Plain Solid Arrow
   \special{color cmyk 1 0 0 0}\allinethickness{0.508mm}\path(110,-395)(380,-310)\special{color cmyk 1 0 0 0}\path(380,-310)(377,-310)(377,-311)(377,-312)(380,-310) % Plain Solid Arrow
\end{picture}

\end{document}

我使用以下命令來編譯

latex spotcolor-picture.tex
dvips -h tex.pro -h xcolor.pro -h spot_color.pro spotcolor-picture.dvi
ps2pdf spotcolor-picture.ps

答案1

你的顏色的名稱是XC@RedSpot,而且你不能在特殊中使用任意單詞,它們通常是關鍵字。如果您想按字面意思插入後記,您可以使用ps: keyword.

以下似乎有效(我刪除了預覽和其他顏色,它們使測試變得複雜)。

\begin{filecontents*}{spot_color.pro}
TeXDict begin
/RedSpotCMYK [0 1 0 0] def
/RedSpotSpot (RedSpot) def
/RedSpotDef RedSpotCMYK aload pop RedSpotSpot findcmykcustomcolor def
/XC@RedSpot{RedSpotDef 1.0 setcustomcolor}XCdef
end
\end{filecontents*}

\documentclass{article}
\usepackage{eepic}
\begin{document}
\setlength{\unitlength}{1mm}
abc 
\begin{picture}(10,10)
\special{ps:  XC@RedSpot 1 setcolor} 
\put(0,0){\line(1,1){10}}
\put(0,10){\line(1,-1){10}}
\end{picture}
\end{document}

在此輸入影像描述

這似乎也有效(但你不能為顏色添加色調:

\begin{picture}(10,10)
\special{color push  XC@RedSpot} 
\put(0,0){\line(1,1){10}}
\put(0,10){\line(1,-1){10}}
\special{color pop   XC@RedSpot}
\end{picture}

相關內容