Hot answers tagged

34

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} ...


33

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 ...


32

Here is another suggestion: \documentclass[varwidth,margin=5mm]{standalone} \usepackage{tikz} \usetikzlibrary{fadings} \newcommand\fadingtext[3][]{% \begin{tikzfadingfrompicture}[name=fading letter] \node[text=transparent!0,inner xsep=0pt,outer xsep=0pt,#1] {#3}; \end{tikzfadingfrompicture}% \begin{tikzpicture}[baseline=(textnode.base)] ...


27

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, ...


26

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 ...


24

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); ...


23

You could use \pgfdeclareradialshading to modify the ball shading. For example, insert: \makeatletter \pgfdeclareradialshading[tikz@ball]{ball}{\pgfqpoint{-10bp}{10bp}}{% color(0bp)=(tikz@ball!30!white); color(9bp)=(tikz@ball!75!white); color(18bp)=(tikz@ball!90!black); color(25bp)=(tikz@ball!70!black); color(50bp)=(black)} \makeatother The ...


22

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} ...


21

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 ...


20

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 ...


19

Thanks to the hints from comments, I created the following proof of concept. This solution is not elegant (yet?) and slow. \documentclass{article} \usepackage{tikz} \usetikzlibrary{decorations.markings} \tikzset{test/.style={ postaction={ decorate, decoration={ markings, mark=at position ...


18

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 ...


18

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) ...


18

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

I don't remember why the scaling was happening but please let me know the missing detail or fix it so I can delete this. ( Stolen from How to draw multiple lines inside the circle ) Something along these lines can be a very impractical but a possible way to do it. I can't think of anything clever how to automate it other than the obvious tedious way. ...


16

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) ...


16

Here are some examples. R=G=B=x (your MWE) R=G=B=x R=G=B=x² R=G=B=√x R=G=B=log(1+x) R=G=B=log(1+9x) R=G=B= ... well ... \documentclass{article} \usepackage[a3paper]{geometry} \usepackage{tikz} \begin{document} \begin{tikzpicture} \fill(-11,0)|-(0,-2)|-(11,2)|-cycle; \shade[left color=black,right color=white](-10,-1)rectangle(10,1); ...


16

It can be done with fadings: \documentclass[tikz,border=5]{standalone} \usetikzlibrary{fadings} \pgfdeclareverticalshading{up}{100bp} {color(0bp)=(pgftransparent!0); color(50bp)=(pgftransparent!0); color(75bp)=(pgftransparent!25); color(100bp)=(pgftransparent!25)} \pgfdeclarefading{up}{\pgfuseshading{up}} \pgfdeclareradialshading{thick ...


15

One option; since the code generated by Geogebra was unnecessarily verbose and complex, I redrew the image which is nothing more than straight lines and arcs; the filling is done with a simple \fill before drawing: The code: \documentclass[tikz,border=10pt]{standalone} \usepackage{siunitx} \usetikzlibrary{angles,quotes,calc} \begin{document} ...


15

Perhaps something like that \documentclass[11pt]{scrartcl} \usepackage{tikz} \begin{document} \pgfdeclareradialshading{ballshading}{\pgfpoint{-10bp}{10bp}} {color(0bp)=(gray!40!white); color(9bp)=(gray!75!white); color(18bp)=(gray!70!black); color(25bp)=(gray!50!black); color(50bp)=(black)} \begin{pgfpicture} ...


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 ...


14

To grease up PS gears, I modified the functional shading given in the PGF manual. I am pretty sure that PSTricks and its foot soldiers are ridiculously better at these type of drawings but Acrobat and Sumatra render pretty impressively. \documentclass[border=5mm]{standalone} \usepackage{tikz} ...


14

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 ...


14

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} ...


14

You can use path fading=east from the fadings library for this: \documentclass{article} \usepackage{tikz} \usetikzlibrary{fadings} \begin{document} \parindent0pt \null \definecolor{orange}{RGB}{233,77,16} \thispagestyle{empty} \vspace{-1cm} \vfill \hfil \begin{tikzpicture}[overlay] \coordinate (gNE) at ...


14

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); ...


14

Another solution exploiting the text rendering modes of the PDF specification to render the text as a clipping path: \documentclass[border=5]{standalone} \usepackage{tikz} \newcommand\shadetext[2][]{% \setbox0=\hbox{{\special{pdf:literal 7 Tr }#2}}% \tikz[baseline=0]\path [#1] \pgfextra{\rlap{\copy0}} (0,-\dp0) rectangle (\wd0,\ht0);% } \begin{document} ...


13

You could try shadings: \documentclass[tikz,border=5]{standalone} \begin{document} \tikz[x=0.125cm,y=0.125cm] \foreach \i in {0,1,...,21} \path [left color=black, right color=white, shading angle={mod(\i,20)*180+90}] (\i*.9,0) rectangle ++(1,10); \end{document} Or fadings: \documentclass[tikz,border=5]{standalone} \usetikzlibrary{fadings} ...


13

Here is a solution with pstricks, and more precisely with pst-grad and pst-text. It is compilable with pdf LaTeX, and the box size can be changed with \psframebox[framesep=…]{…}: \documentclass[pdf, x11names]{article} \usepackage{pst-grad,pst-text} \psset{framesep=2pt} \begin{document} Some text \begin{tabular}{lll} \psframebox[linecolor = Coral1!20]{% ...


13

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 = ...



Only top voted, non community-wiki answers of a minimum length are eligible