我使用 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]
0.1 ---表示fill opacity
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
。