我使用 tikz 產生圖形,然後有一些黑色的陰影部分,一些灰色的陰影部分。圖形在 DVI 和 PS 上看起來不錯,而且這些檔案的列印效果也很好。但是當我使用 pdflatex 生成 PDF 文件時,陰影部分看起來不像 dvi 和 ps 上那麼黑或灰色。附件是我的 LaTeX 程式碼和 pdf 上的圖像。為什麼會出現這種情況?
\documentclass[11pt, oneside, A4paper,final,leqno]{article}
\usepackage{amsmath, amssymb, latexsym, amscd, amsthm}
\usepackage[utf8]{vietnam}
\usepackage{graphics}
\usepackage{tikz}
\usepackage{multicol}
\usepackage{indentfirst}
\usepackage[modulo,left, displaymath]{lineno}
\renewcommand\linenumberfont{\normalfont\bfseries\small }
\usepackage{eurosans}
\usepackage{enumerate}
\usepackage{amsfonts}
\usepackage{curves}
%\usepackage{xcolor}
\usepackage{graphics, graphpap}
\usepackage{pstricks}
\usepackage{pst-eps}
\usepackage{makeidx}
\makeindex
\renewcommand{\thefootnote}{}
\usepackage{pgf,tikz}
\usepackage[left=1.5cm,top=1.8245cm,right=1.85cm,bottom=1.69cm,bindingoffset=0.05cm]{geometry}
\usepackage{pst-coil}
\begin{document}
\subsection*{APMOPS 2014 \rule{4.2cm}{.4pt}}
\begin{enumerate}[\scalebox{1.21}{\bf\arabic{enumi}.}]
\item Find the value of $29999+2999+299+29+9$.
\item \parbox[t]{4.565in}{ $ABCD$ is a parallelogram. $P, Q, R,$ and $S$ are the midpoints of the four sides of the parallelogram. If the area of the shaded region is 20 cm$^2$, find the area of the parallelogram $ABCD$.}
\hspace{1pt}
\raisebox{-38pt}[10pt]{\setlength{\unitlength}{1pt}
\begin{tikzpicture}
\tikzset{scale=.62}
\draw (3,3) -- (7,3) -- (6,1) -- (2,1) -- cycle;
\fill[color=black,fill=black,fill opacity=0.1] (3.4,2.2) -- (5.2,2.6) -- (5.6,1.8) -- (3.8,1.4) -- cycle;
\draw (6,1)-- (5,3);
\draw (3,3)-- (4,1);
\draw (2,1)-- (6.5,2);
\draw (7,3)-- (2.5,2);
\begin{scriptsize}
\draw[color=black] (2.86,3.34) node {$A$};
\draw[color=black] (7.16,3.28) node {$B$};
\draw[color=black] (6.43,1.02) node {$C$};
\draw[color=black] (1.66,1.1) node {$D$};
\draw[color=black] (5.16,3.28) node {$P$};
\draw[color=black] (6.764,1.82) node {$Q$};
\draw[color=black] (4.24,1.2) node {$R$};
\draw[color=black] (2.28,2.28) node {$S$};
\end{scriptsize}
\end{tikzpicture}}
\item Jane added up all the digits of the whole number
\[\underbrace{3\times 3\times 3\times \cdots \times 3}_{\text{product of 2012 of digits 3}},\]
and obtained a new number $N_1$. She then added up all the digits of $N_1$ and obtained another number $N_2$. She continued doing this until she obtained a single digit number. Find the value of this new number.
\item \parbox[t]{4.565in}{The diagram shows three circles of different diameters. The circumference of the smallest circle passes through the center of the middle circle and the circumference of the middle circle passes through the centre of the largest circle. Find the ratio of the shaded area to the unshaded area.
}
\hspace{1pt}
\raisebox{-62pt}[10pt]{\setlength{\unitlength}{1pt}
\begin{tikzpicture}
\tikzset{scale=.3025182}
%\draw(4,1) circle (8cm);
\draw(8,1) circle (4cm);
\draw(10,1) circle (2cm);
\draw(11,1) circle (1cm);
\fill[color=black,fill=gray,fill opacity=0.1](8,1) circle (4cm);
\fill[color=black,fill=white,fill opacity=0.1](10,1) circle (2cm);
\fill[color=black,fill=gray,fill opacity=0.1](11,1) circle (1cm);
\end{tikzpicture}}
\end{enumerate}
\end{document}
答案1
你有
\fill[color=black,fill=black,fill opacity=0.1]
其中fill opacity
0.1 --- 表示 10%。因此,圖形上的黑色斑塊將導致 10% 的黑色和下面的 90%。
在Ghostscript 中dvi
和ps
透過 GhostScript 你可能會得到黑色填充,因為驅動程式不支援透明度...
嘗試使用fill opacity=1
.
從手冊 (v.2.10-CVS) 第 21.2 節:
/tikz/draw opacity= value (no default)
此選項設定線條的“透明度”。值 1 表示“完全不透明”或“完全不透明”,值 0 表示“完全透明”或“不可見”。值為 0.5 會產生半透明的線條。請注意,當您使用 PostScript 作為輸出格式時,此選項僅適用於最新版本的 Ghostscript。
……以及類似的事情fill opacity
。