Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{patterns}

\def\cHeight{0.5}
\def\cWidth{4}
\newcommand{\cigarOne}[2]{
    \pgfmathtruncatemacro\result{\cWidth/2}
    \filldraw[pattern=north east lines] (#1,#2) rectangle (\result+#1,#2-\cHeight);
    \filldraw[pattern=crosshatch dots] (\result+#1,#2) rectangle (#1+\cWidth,#2-\cHeight);
}

\begin{document}
\begin{tikzpicture}
    \cigarOne{2}{5};
\end{tikzpicture}
\end{document}

The command cigarOne defines two filled rectangles, and I want one of them (the left one) to be "pale", kind of hardly visible rectangle.

share|improve this question
    
Did you already tried semitransparent or opacity=<0..1> on the `\filldraw? This makes it paler IMHO (but of course also partially transparent). –  Martin Scharrer Mar 28 '12 at 8:44
    
First, loading tikz is enough, it already loads pgf so you don't have to do that explicitly. Second, why are you loading so many libraries? You only need patterns for this example. Finally, does adding opacity=0.1 to the options of the \filldraw you want to affect give the desired result? You can of course play with the value to get different opacity. –  Roelof Spijker Mar 28 '12 at 8:47
    
setting the opacity = 0.3 did yield kind of what I wanted, but is maybe the "blurring effect" is the best way to describe what I wanted. –  Ilonpilaaja Mar 28 '12 at 8:51
add comment

1 Answer

up vote 3 down vote accepted

Is it like this:

\documentclass{standalone}
\usepackage{tikz,pgf}
\usetikzlibrary{patterns}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
%---------------------------------------------------------
\def\cHeight{0.5}
\def\cWidth{4}
\newcommand{\cigarOne}[2]{
    \pgfmathtruncatemacro\result{\cWidth/2}
    \filldraw[draw=black!10,pattern=north east lines,pattern color=black!10] (#1,#2) rectangle (\result+#1,#2-\cHeight);
    \filldraw[pattern=crosshatch dots] (\result+#1,#2) rectangle (#1+\cWidth,#2-\cHeight);
}
%---------------------------------------------------------
\begin{document}
\begin{tikzpicture}
    \cigarOne{2}{5};
\end{tikzpicture}
%---------------------------------------------------------
\end{document}  

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.