Tag Info

33

Something like that ? \documentclass{standalone} % needs logicpuzzle bundle v1.8 % http://mirrors.ctan.org/graphics/pgf/contrib/logicpuzzle/logicpuzzle.sty % or replace logicpuzzle -> battleship \usepackage{logicpuzzle} \makeatletter \definecolor{LPlgrey}{rgb}{.8,.8,.8} \definecolor{LPtgrey}{rgb}{.7,.7,.7} \definecolor{LPgrey}{rgb}{.5,.5,.5} ...

21

You can get an effect like the shading on the go stones in the picture with radial shading. I don't know how to get radial shading off-center, so some clipping is needed: \begin{tikzpicture} \begin{scope} \fill[black] (0,0) circle (0.5); \clip (0,0) circle (0.5); \shade[outer color=black, inner color=black!30] (-0.15,0.5) circle ...

20

You could use TikZ together with an auxiliary pdf file that contains a square that is filled with a white with full opacity to white with no opacity shade. Then overlay this auxiliary pdf on all four sides, stretching them to the correct size. (UPDATE: See update below for how to do this without the external pdf file). Using an external pdf file The code ...

17

This only concerns your additional question, e.g. how to get such a "wood like" background: \documentclass[parskip]{scrartcl} \usepackage[margin=15mm]{geometry} \usepackage{tikz} \usetikzlibrary{calc,spy} \begin{document} % parameters for the "wooden rectangle", chosen to be measures of a Go board \pgfmathsetmacro{\relativefibrethickness}{0.50} ...

17

As already mentioned by Andrew Stacey in some comment, TikZ is not a real 3D system - and a radial fading is a two-dimensional construct. You would need some 3d projection algorithm to compute the colors. A possibility would be to sample such a projection and to interpolate between the sampled points. This is not directly supported by TikZ (because it ...

16

Do you mean something like the first or the second circle? The code in which they are realized is: \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \filldraw[even odd rule,inner color=red,outer color=white] (0,0) circle (2.2); \draw(0,0) circle (1.8); \begin{scope}[xshift=6cm] \filldraw[even odd rule,inner color=red,outer ...

16

15

I'm following the earlier post Is there a way to tune ball shading in TikZ ?, particularly Stefan Kottwitz's answer. He showed how to use \pgfdeclareradialshading to change the radial shading. Changing the parameters for the radial and adding some clipping, I can produce this: Is that sphere enough? Perhaps with some more tweaking it is possible to get an ...

14

If the light source is a long way away, the intensity at each point is the dot product between the position vector and light source vector (in R3), thresholded at 0. This uses the \pgfdeclarefunctionalshading command from percusse's answer. Of course, we're only given two elements of each vector, so we need to first compute the third. For some reason, ...

14

Solution below uses the Asymptote module tubepuzzle.asy to set up the puzzle and to draw it. The puzzle is defined by dimensions and a pipe path, numbers are counted automatically. File tpuzzle.tex: \begin{filecontents*}{tubepuzzle.asy} struct TubePuzzle{ int m,n; pair start; pair fin; guide pipe; pen inPen,outPen; pen txtPen,gridPen; pen ...

13

You can also use PGFPlots and adapt the approach from Draw a bivariate normal distribution in TikZ to draw gaussian ellipses. Note that this is much slower than John's approach. \documentclass{standalone} \usepackage{pgfplots} \usepgfplotslibrary{patchplots} \begin{document} \pgfplotsset{ colormap={whitered}{color(0cm)=(white); ...

12

You should go to section 83.2.2 Radial Shadings of the pgfmanual (version October 25, 2010). Here is a solution in which the color of that example is a bit changed and different center points are used: \documentclass{article} \usepackage{pgf} \begin{document} % spheres definitions \pgfdeclareradialshading{sphere}{\pgfpoint{0cm}{0cm}}% {rgb(0cm)=(1,1,1); ...

12

I can confirm that there are differences between LuaLatex and pdflatex: the pgfplots driver which produces shader=interp does not work for LuaLateX until and including pgfplots 1.5.1 (the problem is related to the production of binary output in the pgfplots drivers). This has been fixed in the development version of pgfplots; it will become part of the next ...

11

TikZ can do this in its sleep. This is a slightly modified approach to what is given in the tikz documentation (section 2.14 Shading, p 31): \documentclass{article} \usepackage{tikz}% http://ctan.org/pkg/pgf \usepackage{lipsum}% http://ctan.org/pkg/lipsum \begin{document} \begin{tikzpicture}[remember picture,overlay] \shade[left color=white,right ...

11

My solution is based on Highlight elements in the matrix. Indeed, one possibility here is to exploit matrices. The code: \documentclass[a4paper,12pt]{article} \usepackage{xparse} \usepackage{tikz} \usetikzlibrary{calc,matrix,patterns,shadings,backgrounds} \pgfdeclarelayer{myback} \pgfsetlayers{myback,background,main} \tikzset{myfillcolor/.style = ...

11

You should try to draw arcs and lines from the center of the nodes. This can be done with the help of positioning library of tikz. Code \documentclass{article} \usepackage{tikz} \usetikzlibrary{positioning} \tikzset{state/.style={circle,draw=black, very thick,inner sep=3pt,fill=white}} \begin{document} \begin{tikzpicture} \node[state] (a) at (0,0) ...

11

Somewhat more compact. \documentclass[tikz]{standalone} \tikzset{state/.append style={circle,draw=black,fill=white, minimum size=4ex,very thick,inner sep=3pt}} \begin{document} \begin{tikzpicture} \coordinate (a) at (0,0); \coordinate (b) at (2,0); \coordinate (c) at (2,-1.5); \coordinate (d) at (0,-1.5); \draw (a) rectangle ...

11

At the moment, the shade key is only a one way switch: It only switches shadings on, but it can't switch them off. It's easy to redefine, however: \makeatletter \def\tikz@falsetext{false} \tikzset{ shade/.code={ \edef\tikz@temp{#1}% \ifx\tikz@temp\tikz@falsetext% \tikz@addmode{\tikz@mode@shadefalse}% \else% ...

11

Here's a TikZ solutions that draws white rectangles over the picture: Code \documentclass[parskip]{scrartcl} \usepackage[margin=15mm]{geometry} \usepackage{tikz} \usetikzlibrary{calc} \usepackage{lipsum} \newcommand{\blurrypic}[5]% pic, scale, border, iterations, opacity { \begin{tikzpicture} \node[inner sep=0pt,outer sep=0pt] (temppicnode) ...

11

What you could do is layer lots of ellipses on top of each other, each one a little bit smaller and darker than the previous one. This gives the illusion of a smooth gradient, providing there are enough ellipses. In the code below I'm using ten ellipses, but you can adjust that to your liking. Code \documentclass{article} \usepackage{tikz} \begin{document} ...

10

You can do many things only with clipping (if at all). If you know the specific point you can do this in one entire path: \draw[fill=gray!50] plot[smooth, samples=100, domain=1:e] (\x,ln \x) -| (0,0) -- cycle; If you don’t know the points, you will need to use clip or even intersections. Code \documentclass[tikz]{standalone} \tikzset{ saveuse ...

10

A solution with a PDF shading. Problems start if you want to do this more flexible (with different angles) as there is no proper way to change the shading dependent of other values besides colors. (I tried using colors to smuggle in values but that failed already at Is there another better way to have a region with gradient opacity?) The second example ...

10

My answer to Gradient color in one cell of a table produces shaded cells and can easily be adapted to produce hatched patterns. This solution works with tabular, tabularx (tabulary will also be OK I imagine, although I didn't test it) and with \multicolumn: \documentclass[10pt]{article} \usepackage[margin=2cm]{geometry} % just for the example ...

10

You need to create the region at one shot and use even odd rule or nonzero rule with some trickery for these applications. Here is one example: \documentclass[tikz,border=5mm]{standalone} \usetikzlibrary{fadings} \pgfdeclareradialshading{myring}{\pgfpointorigin} { color(0cm)=(transparent!0); color(5mm)=(pgftransparent!50); color(1cm)=(pgftransparent!100) } ...

10

To shade a mindmap it is necessary to add a shading to the nodes. Let's start to add a shading style different for each level; the method used is simple: different concepts will have different ball colors. The code: \documentclass[a4paper,11pt]{article} \usepackage{tikz} \usetikzlibrary{mindmap} \tikzset{level 1 concept/.append style={font=\sf, sibling ...

10

This is possible with \colorbox and the package xcolor. You need to add only one macro and to set \fboxsep to 0pt. \documentclass[12pt]{article} \usepackage{picture,xcolor} \begin{document} \begin{figure}[hp] \begin{center} \setlength{\unitlength}{1cm} \begin{picture}(7,3)(0,0) \setlength\fboxsep{0pt} ...

10

Basic Solution: I would recommend that you use the mdframed package instead (as it will work across page breaks), and use the resume* option with lists via the enumitem package: Better Solution: As @MarcoDaniel suggested, a better looking solution is to use the frametitle option with mdframed. \newenvironment{Question}[1]{ \begin{mdframed}[ ...

10

You can use the predefined cylinder shape and then draw an ellipse with a solid fill on top. With the following code, you can supply all the options to the cylinder shape as before, the let code in the ellipse takes care of the position, size and rotation of the ellipse. You only need to adjust the colour. The operation let \p<number> = ...

9

I don't know any good place from where to learn all the material, but I can try to give you a few pointers. The following comes with the caveat that I only dabbled in writing shaders a bit and am certainly no expert on this topic. Abstractly, a functional shader is given by a function f: R → [0,1]³, where R is some subset of ℝ² (usually a rectangle) and ...

9