The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Hot answers tagged

37

You can "color" the text by anything, including external graphics. This is possible with the fadings library, which has been used e.g. here and here. I downloaded your graphics and called it GoldLeaf.jpg. This graphics gets used in the macro \ShadeText, which does the path fading and adjusts the size of the graphics to fit the text. If you want to use the ...


23

Just for fun, here is a solution using contour package... \documentclass[tikz]{standalone} \usepackage{lmodern} \usepackage[outline]{contour} \newcommand\clock[2]{% \begin{tikzpicture}[cap=round,rotate=90] % colors \colorlet{minutes color}{blue!50!cyan!70!black} \colorlet{bg hours 0}{yellow} \colorlet{bg hours 1}{red!50} \colorlet{...


19

\documentclass[border=5pt,tikz]{standalone} \begin{document} \begin{tikzpicture}[xscale=1,yscale=1] \fill[blue!20] (0,-2.5) --+ (0,2.5) arc (0:180:1.5) -- (-3,-2.5) arc (180:235:3) --+ (0,-.25) --+ (.45,-.25) --+ (.45,.015) (0,-2.5) arc (0:-55:3); \fill[white] (0,0) arc(0:180:1.5) --+ (0,-2) -| cycle; \fill[blue!10] (-1.5,-2) circle ({1....


12

There are two kinds of patterns: inherently coloured ones and colourless ones. This pattern defined as 'form only'. It isn't intended to take a colour in the definition, which is assumed to be colourless. Instead, use pattern color to set the colour when using the pattern. \documentclass[border=10pt,11pt]{standalone} \usepackage{tikz} \usetikzlibrary{...


12

I think it might not be possible to use text in actual patterns, but I would be happy to be proven wrong. Here are two ways to accomplish what you want without using patterns. The first one uses a node to print the text and then \clips it. For more information on clipping, see section 2.11 (p36) of the pgf manual (for version 3.1.1). The second one uses ...


11

Something like this? \documentclass[border=5pt, multi, tikz]{standalone} \pgfdeclareradialshading[fradialcolour]{fradial}{\pgfpoint{0}{0}}{% manual 1082-1083 color(0)=(black); color(20bp)=(fradialcolour); color(40bp)=(black) } \colorlet{fradialcolour}{blue!50!cyan} \begin{document} \begin{tikzpicture} \fill [shading=fradial] (0,0) rectangle (2,2); \...


11

You've used bend left/bend right earlier in the drawing, use that again, and it works fine. For example \draw[fill=white] (8.5,0) to[bend right] (4.5,0); This image shows output of your original code, with some style changes. The blue arrow is made with bend left, the dashed red line with parabola bend. They're not 100% equivalent, but very close. Speaking ...


11

Just for fun and learn, an option using let to calculate the angle of the shadow lines to draw from the top and bottom of the sun to certain distance to the planet (0,2) -- +(-\n1:9.5), then save this coordinate as coordinate (a) and the other from (0,-2) -- +(\n1:9.5) save as coordinate (b) to draw easily the shadow using the coordinates of the moon, also ...


10

It is possible to draw the parabola bend horizontally and then rotate it. I have named the coordinates to make things easier for me: \documentclass{article} \usepackage{hyperref} \usepackage[usenames,dvipsnames,x11names]{xcolor} \usepackage{tikz} \usetikzlibrary{positioning} \usetikzlibrary{arrows,snakes,shapes} \begin{document} \begin{tikzpicture} % ...


9

Both commands should be equivalent in this case. The difference in your example comes from extra spaces inserted before and after the stretchable glues. In the \hspace version we have: \fbox{...} % <-- The line end here inserts an extra space token \hspace*{\fill}\vrule\hspace*{\fill} % <-- Same here \fbox{...} The case is different however in ...


9

Your two inputs, when written without line breaks, look like \fbox{...} \hfill\vrule\hfill \fbox{...} \fbox{...} \hspace*{\fill}\vrule\hspace*{\fill} \fbox{...} because an end-of-line is translated into a space. However, the one in the first line after \hfill gets ignored, because it follows a control sequence name. In the second example neither space ...


9

This looks like a code golfing challenge ;) \documentclass[tikz,border=7pt]{standalone} \usetikzlibrary{svg.path} \begin{document} \begin{tikzpicture}[scale=3] \draw svg{M6 0V8A6 6 0 0 1-6 8V0}; \draw[fill=blue!20] svg{M6 0c0-9-3-11-5-13v-1h-2v1c-2 2-5 4-5 13}; \end{tikzpicture} \end{document}


9

Depends on what you mean precisely by "mixture of colors". You can use a path fading (cf. this answer) to e.g. achieve \documentclass{article} \usepackage{tikz} \usetikzlibrary{fadings,shadings} \usepackage{fontawesome5} \newcommand{\ShadeChar}[2][]{% \begin{tikzfadingfrompicture}[name=temp] \node[transparent!0] {#2}; \end{tikzfadingfrompicture}% \tikz[...


8

Draw them in the order you want them displayed. Just because you define the coordinates at the start doesn't mean you have to draw them then. Indeed, it can make for cleaner picture code to set up all the coordinates at the start as just coordinates and then to do the drawing afterwards. This gives greater control over things like the order in which ...


8

Here is an idea: % My standard header for TeX.SX answers: \documentclass[a4paper]{article} % To avoid confusion, let us explicitly % declare the paper format. \usepackage[T1]{fontenc} % Not always necessary, but recommended. % End of standard header. What follows pertains to the problem at hand. \usepackage{...


8

Here is another suggestion using nodes instead circles and the tangent cs: \documentclass[a4paper,twoside]{article} \usepackage{tikz} \usetikzlibrary{backgrounds} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \newcommand\winkel{75} \path[nodes={circle,outer sep=0pt}] (0,0) node(sonne)[fill=yellow,minimum size=4cm]{} (sonne.\winkel) ...


8

You could, perhaps, change the definition of \dotfill and \lower the dots a little bit: \documentclass{article} \makeatletter \def\lowerdotfill{% \leavevmode \cleaders \hb@xt@ .44em{\hss\lower0.5ex\hbox{.}\hss}\hfill \kern\z@} \makeatother \begin{document} Fill in:\dotfill\par Fill in:\lowerdotfill \end{document} or, maybe, use \dotuline from the ...


7

If you don't want the white fill then you can punch the rectangle and repat the path (and use even odd rule if complex paths are used). If you have a really complicated path then use layers and send them to different layers. \documentclass[tikz]{standalone} \usetikzlibrary{patterns} \begin{document} \begin{tikzpicture} \fill[yellow!20] (-1,-1) rectangle (5,...


7

Rewriting your code, you can use the main square as a \clip, then place a circle at the lower left with a radius equal to the square's side. You can then apply a path fading to this circle. Also, switch from minimal to standalone for single graphics. Output Code \documentclass[margin=10pt]{standalone} \usepackage{tikz} \usetikzlibrary{fadings} \...


7

As noted in the comments, this is a change that was introduced in TeX Live 2017. (In fact it was introduced on 2017-04-11, according to the change log.) Investigation This isn't really important, but if you're curious as to how I found this, these were my steps. If you compile the MWE with the addition of the line \showoutput using TL 2017 and TL 2016, ...


7

One possibility is to define a custom \addlegendimage: \documentclass{article} \usepackage{tikz, pgfplots} \pgfplotsset{compat=1.13} \pgfplotsset{ legend image with text/.style={ legend image code/.code={% \draw [#1,yshift=-0.5ex] (0,0) rectangle (4ex,1.5ex); } }, } \begin{document} \pagenumbering{gobble} \begin{...


7

(As requested in a comment.) I had the same idea as Phelype, \addlegendimage, for solving what you actually asked about. The code below has some other simplifications as well. Instead of five plots with \closedcycle to generate the vertical dashed lines, I use a single \addplot [ycomb, ..] to do so. This works in this case, but might not look good in other ...


7

Welcome to TeX.SE. From the next time try adding a compilable MWE, so that it will attract more users to answer your question. You can start with (borders): \documentclass{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} \filldraw [black] (3, 2) --(3,0)--(0,0) plot [smooth, tension=2] coordinates { (0,0) (1,1) (2, 1) (3, 2)}; \...


6

Here's a third option which requires neither re-ordering your code nor loading an additional library. This relies on the fact that the black circles are darker than the grey fill. Given that, we can add blend mode=darken to the command which adds the fill and the grey will not paint over the darker circles behind. \documentclass[border=10pt,multi,tikz]{...


6

You can draw a thick circle \draw[line width=1.5cm, red!30] (0,0) circle (7.00cm); and later on fill some sectors: \foreach \i in {60,0,...,-240} \fill[yellow!30] (\i:6.25cm) -- (\i:7.75cm) arc (\i:\i-30:7.75cm)--(\i-30:6.25cm) arc (\i-30:\i:6.25cm)--cycle; Complete code: \documentclass{standalone} \usepackage{tikz} \newcommand\clock{% } \begin{...


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