Hot answers tagged

36

I'm not sure what you mean by "\textcircled doesn't seem to like this", because \documentclass{article} \begin{document} \raisebox{.5pt}{\textcircled{\raisebox{-.9pt} {$f_n$}}} \end{document} compiles fine for me. That said, it does look a bit rubbish: You might consider a little TikZ picture for this situation. You could put the $f_n$ inside a ...


31

in tikz any coordinate of any path command is determined for the infinitely thin lines. the real lines lie over them so that their centers matches. line width of real lines is accessible with length \pgflinewidth. knowing it, it is simple to correct size of some elementary shapes as are rectangles, squares and circles with considering line widths. for ...


29

Something like this? \documentclass{article} \usepackage{tikz,calc} \newlength\charwidth \newlength\chwidth \newcommand*\circled[1]{% \settowidth\charwidth{#1\,\%}% \settototalheight\chwidth{#1\,\%}% \ifdim\chwidth>\charwidth\let\charwidth\chwidth\fi \addtolength\charwidth{5pt}% twice inner sep plus half line width \tikz[baseline=(char.base)]{% ...


29

\documentclass{standalone} \usepackage{tikz} \usepackage{calc} \newlength{\outerradius} \newlength{\innerradius} \setlength{\outerradius}{2cm} \setlength{\innerradius}{1.5cm} \newcommand{\progresscircle}[1]{ \begin{tikzpicture} \fill[black!50] (0,0) circle (\outerradius); \fill[violet!70] (0,0) -- (0, \outerradius) arc (90:90-3.6*#1:\...


23

Time to call \foreach. \documentclass{report} \usepackage{tikz,calc} \begin{document} \begin{tikzpicture} \foreach \a in {1,2,...,17}{ \draw (\a*360/17: 4cm) node{angle \a}; } \end{tikzpicture} \end{document}


21

How about this: The command \satisfaction takes one parameter, which has to be a number from 0 to 4. And with the optional parameter, the color can be set. It scales with fontsize. And without optional parameter it takes the surrounding color. The code: \documentclass[10pt,a4paper]{article} \usepackage{tikz} \newdimen\satlevel \newdimen\satdiameter \...


20

In this case it is pretty simple to use the calc and intersections library: \documentclass[tikz,border=0.125cm]{standalone} \usetikzlibrary{calc,intersections} \begin{document} \begin{tikzpicture} \path [rotate=60] (0,0) coordinate (A) (-2,-3) coordinate (B) (0,-3) coordinate (C) ($(B)!2!(C)$) coordinate (D) ($(A)!0.5!(B)$) coordinate (...


19

A recommended solution with PSTricks (plus supporting Chinese characters as you are living in Macau, China), just for best-practitioners. \documentclass[pstricks,border=12pt]{standalone} \usepackage{pst-eucl} \usepackage{CJKutf8} \newsavebox\IBox \begin{document} \begin{CJK}{UTF8}{bsmi} \savebox\IBox{中} \begin{pspicture}[showgrid=false](5.75,4.25) \...


18

The TikZ-way you tried works, you just forgot to set the baseline of the tikzpicture to the baseline of the text inside the math node. Here is an adjusted solution which also respects the mathstyle outside of the node. \documentclass{article} \usepackage{mathtools}% superior to amsmath \usepackage{tikz} \makeatletter \newcommand\mathcircled[1]{% \...


18

You don't need to connect nodes. First draw background lines. All starting from (0,0). \foreach \angle in {0,1,...,359} \draw[cyan!50!black] (0,0)--++(\angle:4); Second, draw a circular node white filled: \node[circle, fill=white, text=cyan!50!black, text width=15mm, align=center]{Orion\\2000}; And third (although it's the first command), define the ...


18

It's among the worst notation I have ever seen. If you really want it, at least do it right, with the dot in the middle of the D. \documentclass{article} \usepackage{amsmath} \usepackage{xparse} \usepackage{mathpazo} \NewDocumentCommand{\disk}{smm}{% \IfBooleanTF{#1}{\puncturedD}{D}[#2,#3]% } \makeatletter \newcommand{\puncturedD}{{\vphantom{D}\...


16

Edit Here is a second (better?) solution: \documentclass[border={0pt 0pt 0pt 0pt}]{standalone} \usepackage{graphicx,xcolor} \usepackage{pgf,tikz} \usetikzlibrary{arrows,shadings,decorations.text,shadows,fadings} \pgfdeclareradialshading{glow}{\pgfpoint{0cm}{0cm}}{ color(0mm)=(white); color(3mm)=(white); color(7mm)=(black); color(10mm)=(black) } ...


16

Opening notes There is a lot of interesting examples created in the D3js library, see e.g. mbostock's blocks or this gallery. It's quite inspiring. Those examples are fast and we could get SVG files at a JavaScript level, if needed (easily convertible to PDF, TikZ etc.). Let me focus on these types of graphs. I believe these examples belong to a field of ...


16

Something like this? \documentclass[12pt,a4paper]{memoir} \usepackage[utf8]{inputenc} \usepackage{tikz,float} \usepackage{tabularx} \usepackage{xparse} \NewDocumentCommand{\statcirc}{ O{#2} m }{% \begin{tikzpicture} \fill[#2] (0,0) circle (1.0ex); % Fill circle with base colour (arg#2) \fill[#1] (0,0) -- (180:1ex) arc (180:0:1ex) -- cycle; % ...


15

I found this code works fine with me. \usetikzlibrary{arrows} \usetikzlibrary{shapes} \newcommand{\mymk}[1]{% \tikz[baseline=(char.base)]\node[anchor=south west, draw,rectangle, rounded corners, inner sep=2pt, minimum size=7mm, text height=2mm](char){\ensuremath{#1}} ;} \newcommand*\circled[1]{\tikz[baseline=(char.base)]{ \node[shape=...


15

The shapes.misc library offers the rounded rectangle shape. You can also use the shadows library to add shadows. \documentclass[border=3pt]{standalone} \usepackage{tikz} \usetikzlibrary{shapes.misc,shadows} \begin{document} \begin{tikzpicture}[baseline=(char.base)] \node(char)[draw,fill=white, shape=rounded rectangle, drop shadow={opacity=.5,shadow ...


15

You don't have to put the commands in a scope, you can pass the options to the commands directly: \draw[canvas is xy plane at z=0] ...;, but this greatly increases line length. Instead you can define styles with a parameter to use these: \tikzset{my style name/.style={canvas is xy plane at z=#1}} And as a small remark: instead of giving the unit vectors ...


15

One (somehow verbose) option: The code: \documentclass{article} \usepackage{tikz} \usetikzlibrary{angles,quotes} \def\myrad{3cm}% radius of the circle \def\myang{60}% angle for the arc \begin{document} \begin{tikzpicture} % the origin \coordinate (O) at (0,0); % the circle and the dot at the origin \draw (O) node[circle,inner sep=1.5pt,fill] {} circle [...


15

Here's an alternative way to draw your circle + vectors using Metapost and luamplib. Compile with lualatex (assuming you have the TeX Gyre maths fonts available). \documentclass[border=5mm]{standalone} \usepackage{luamplib} \usepackage{unicode-math} \setmathfont{TeX Gyre Termes Math} \begin{document} \mplibtextextlabel{enable} \begin{mplibcode} beginfig(...


15

Using clipping? I am using a scope here to restrict the clipping to it. \documentclass[margin=5pt]{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} \begin{scope} \draw [clip] (0,0) circle (1cm); \draw (0,-1) -- (0,1); % first (center) line \foreach \x in {1,...,4} {% 4 lines per side \...


15

an alternative: used polar coordinates define radius of circle and with it also calculated distances of nodes from circle centre \documentclass[tikz, margin=3mm]{standalone} \usepackage[spanish]{babel} \usepackage[T1]{fontenc} \usetikzlibrary{babel} \begin{document} \begin{tikzpicture} \def\R{3cm} % defined radius of circle \draw (0,0) circle[radius=\...


15

A simple \stackinset with a scalerel wrapper thrown around it will support the smaller math styles. \documentclass{article} \usepackage{stackengine,scalerel} \newcommand\dotD{\ThisStyle{\ensurestackMath{% \stackinset{c}{.7\LMpt}{c}{-.2\LMpt}% {\SavedStyle\cdot}{\SavedStyle D}}}} \begin{document} \[ x\dotD\scriptstyle\dotD\scriptscriptstyle\dotD \] \end{...


14

\newcommand\filledcirc{{\color{red}\bullet}\mathllap{\circ}} gives you a \circ filled with red color. You need usepackage{mathtools} for the \mathllap command. To change the border color as well, just change the color of the \circ, like so: \newcommand\filledcirc{{\color{red}\bullet}\mathllap{\color{blue}\circ}}. The advantage over Tikz solutions is that ...


14

this answer has been converted in a package on CTAN: https://ctan.org/pkg/circledsteps The answers here are all nice, and especially the tikz one is greatly configurable. But it has a problem: you can't use it inside other tikzpictures safely. So I merged a couple of things and implemented this: \documentclass{article} \usepackage[T1]{fontenc} \usepackage[...


14

To connect the edges of the circle you can use the border anchors of nodes (A.120) and the to Operator to connect it to the outer square. \documentclass[tikz, border=5mm]{standalone} \begin{document} \begin{tikzpicture} \draw[clip] (-2,-2) rectangle +(3,3); \node[minimum size=5cm](A){}; \node[circle, draw, minimum size=1cm](B) at (A.center) {}; \foreach \...


14

For fun, here is a style vlines using path picture and grid to draw the lines. \documentclass[tikz,border=7pt]{standalone} \tikzset{ vlines/.style={ path picture={ \draw[xstep=#1, ystep=100cm, shift={(path picture bounding box.south west)} ] (path picture bounding box.south west) grid (path picture bounding box.north east); } } } \...


14

Are you looking for this 5-petal "water-lily" ? % a 5-petal rose (or "water-lily" if you like ^^) \documentclass[tikz,border=3mm]{standalone} \begin{document} \begin{tikzpicture} \def\R{3} \draw (0,0) circle(\R); \draw[smooth,magenta] plot[domain=0:36*5,samples=200] (\x:{\R*cos(5*\x)}); \end{tikzpicture} \end{document} I update the ...


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