• With a sense of humor, just for fun. TeX and 3d printers
    by user284656 on December 25, 2024 at 10:30 pm

    Please, do not be too serious. TeX is the digital version of Gutenbergs typesetting. Now, how about taking it the other way around? With TeX and modern 3d printers, it should be possible, to produce ancient matrixes. Is there something existing like that?

  • How to simplify/refactor this code even more?
    by MS-SPO on December 21, 2024 at 7:54 pm

    The following code origines from a joke in German, visualizing the answer "50 grays of Schade." (see below). The code: puts 7 x 7 tiles + 1 bigger background tile distributing in a cyclic way the characters S c h a d e . changes each tiles gray-fill randomly in a predefined way puts out a row of tiles using \foreach via \msrow{}{} (from refactoring) leaving the call to the 7 rows unrefactored (modified) Random sequence without replacement to obtain different shades (from R: sample(1:100,50,replace=FALSE)) with one error from copying, which you may or may not use as input: 37 32 80 12 55 6 17 41 44 95 9 97 88 18 8 8 14 42 11 47 68 99 73 1 5 84 81 40 21 59 43 39 64 82 38 24 85 34 89 50 20 92 65 53 67 76 23 70 30 If possible, this code should become even more compact, without sacrifycing legibility. But feel free to take different routes, too. \documentclass[10pt,border=3mm,tikz]{standalone} \newcommand\msrow[2]{% \foreach \g/\t [count=\i] in {#2}% \node[bx,fill=black!\g] at (\i,#1) {\t};} \begin{document} \begin{tikzpicture}[ % bx/.style={minimum size=1cm,text=red,font={\bf}},% see cfr's remark bx/.style={minimum size=1cm,text=red,font={\bfseries}}, ] % ~~~ background ~~~~~~~~~~~~~~~~~~~~~~~~~~ \node[fill=black!50, minimum size=8cm] at (4,4) {}; % ~~~ all those tiles ~~~~~~~~~~~~~~~~~~~~~ \msrow{7}{37/S, 32/c, 80/h, 12/a, 55/d, 6/e, 17/.} \msrow{6}{41/c, 44/h, 95/a, 9/d, 97/e, 88/., 18/S} \msrow{5}{ 8/h, 8/a, 14/d, 42/e, 11/., 47/S, 68/c} \msrow{4}{99/a, 73/d, 1/e, 5/., 84/S, 81/c, 40/h} \msrow{3}{21/d, 59/e, 43/., 39/S, 64/c, 82/h, 38/a} \msrow{2}{24/e, 85/., 34/S, 89/c, 50/h, 20/a, 92/d} \msrow{1}{65/., 53/S, 67/c, 76/h, 23/a, 70/d, 30/e} \end{tikzpicture} \end{document} Background, the joke in German: "Kannst du mir sagen, was neun auf Englisch heißt?" - Can you please tell, what's nine in English? "Nine." - Sounds exactly like: "No" (Nein) "Schade." - Too bad (looks like "shade", and sounds a bit similar, too) 50 grays of S(c)hade ...

  • Beautiful clocks using bxcoloremoji package
    by Sebastiano on November 27, 2024 at 9:33 pm

    This is a follow-up of the question A grid in a cartesian plane of clocks using clock package Starting from the answer of @Ignasi: \documentclass{article} \usepackage{clock} \usepackage{tikz} \begin{document} \begin{tikzpicture} \foreach \i in {1,...,10}{ \foreach \j [evaluate=\j as \h using {int(12*rnd)}, evaluate=\j as \m using {int(60*rnd)}] in {1,...,10} \node at (\i,\j) {\clock{\h}{\m}};} \end{tikzpicture} \end{document} is it possible to have the clocks using this recent package bxcoloremoji (v1.0a [2024/11/18])?

  • Shipout box to tempfile
    by Anthony D'Arienzo on May 27, 2024 at 6:18 pm

    I currently have a Python script which (through ImageMagick) makes a PDF appear photocopied. I am trying to migrate this process to a LaTeX class—for fun, to see what is possible in LaTeX. It seems that one way this could work is to intercept \shipout with some external calls to modify the output PDF. Using atbegshi for intercepting shipout, the procedure would look like Generate a page worth of LaTeX code. AtBeginShipout, write the contents of AtBeginShipoutBox (i.e., \Box255) to a temporary file, temppage.tex. Call pdftex on the temporary file and distort the PDF via ImageMagick to a temporary file temppage.png. Instead of shipping out the contents of AtBeginShipoutBox, shipout a box containing \includegraphics{temppage.png}. When write18 is enabled, steps (3) and (4) seem mostly straightforward. This leaves step (2). Is it possible to explicitly shipout a box to a temporary PDF? If that is not possible, perhaps there is a reliable way to echo the raw TeX of a box to a tempfile to be compiled later? The end goal is a LaTeX class which need not call another script to make the output PDF look photocopied.

  • Possible to dot your Is with hearts?
    by Infimum on April 22, 2024 at 8:13 am

    I was wondering if it is possible to replace just the mathmode i from the default latex font with nearly the same letter, but where the dot on the i is a small heart. For example: Thank you!

  • How to make an \egreg command?
    by Gaussler on April 1, 2023 at 7:31 am

    I would like a command \egreg which produces “egreg”. However, there is no reason to limit yourself to one “reg”. Who knows, maybe one day you just feel like writing “egregregregreg" for some reason. So the command should also take an optional argument, specifying the number of “reg”’s you want. I know there are easy solutions involving loops, but given that it’s April 1, the most ridiculous solution will be accepted. \documentclass{article} \NewDocumentCommand\egreg{o}{% % something } \begin{document} \egreg % should produce "egreg" \egreg[0] % should produce "eg" \egreg[1] % should produce "egreg" \egreg[2] % should produce "egregreg" \egreg[5] % should produce "egregregregregreg" Perhaps we might also want to allow negative values: \egreg[-1] % should produce "regeg" \egreg[-2] % should produce "regregeg" Maybe also complex values? \egreg[i] % perhaps "$\text{eg} + i\text{reg}$"? Perhaps someone can also figure out what to do with quaternionic values? \end{document}

  • Draw a unicorn in TikZ 🦄
    by Martin Thoma on March 31, 2023 at 2:42 pm

    I'm currently reading Sparks of Artificial General Intelligence: Early experiments with GPT-4. This paper by Microsoft employees experiments with the capabilities of GPT-4, a successor of ChatGPT. One task is to draw a unicorn with tikz.ㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤ They claim: GPT-4 produces impressive outputs that are [...] at least comparable (if not superior) to what a human would do. Who wants to prove them wrong? 😄🦄🌈 edit: Please don't include PNG / JPG / other pixel image formats. MS-SPO is the only one allowed to do that (as a grandfathering-rule) - kudos for finding the loophole in this question and for thinking outside of the box 😁👍 edit: We now have 200 fun questions! 🥂🥳

  • How to make garden in TikZ [closed]
    by Guest on March 25, 2023 at 3:15 pm

    How to make a garden such as following in LaTeX, using TikZ? It's interesting to know conceptual approaches, e.g. using nodes with image or other tikz elements.

  • Using TikZ to celebrate Valentine's Day
    by euler_med on February 14, 2023 at 10:12 pm

    While this is not a specific inquiry, I would like to witness the creativity of the members on this forum. As it is the 14th of February, I had hoped to commemorate the occasion by creating an aesthetically pleasing image that conveys love (even though I'm single af XD). With that being said, I present to you a simple mandala I was able to produce using TikZ: \documentclass[tikz, border=10mm]{standalone} \usepackage{fontawesome5} \definecolor{vblue}{HTML}{041562} \definecolor{vred}{HTML}{DA1212} \usetikzlibrary{decorations, decorations.markings, shadings, fadings} \usepackage{calligra} \usepackage[T1]{fontenc} \begin{document} \shade[inner color = vblue, outer color=vred] (0,0)circle(4.5); \draw[vblue, line width=0.7mm] (0,0)circle(4.5); %You can think of a for loop here and draw these things once ! \draw[line width=0.4mm, vblue] (45:3.5)..controls(60:4) and (65:3)..(80:3.5); \draw[line width=0.4mm, vblue] (10:3.5)..controls(25:3) and (30:4)..(45:3.5); \draw[line width=0.4mm, vblue] (135:3.5)..controls(120:4) and (115:3).. (100:3.5); \draw[line width=0.4mm, vblue] (170:3.5)..controls(155:3)and(150:4)..(135:3.5); \draw[line width=0.4mm, vblue] (-45:3.5)..controls(-60:4) and (-65:3)..(-80:3.5); \draw[line width=0.4mm, vblue] (-10:3.5)..controls(-25:3) and (-30:4)..(-45:3.5); \draw[line width=0.4mm, vblue] (-135:3.5)..controls(-120:4) and (-115:3).. (-100:3.5); \draw[line width=0.4mm, vblue] (-170:3.5)..controls(-155:3)and(-150:4)..(-135:3.5); %The hearts \foreach\i in{45, 135, -45, -135}{ \node[vblue, rotate=-90+\i] at (\i:4) {\faHeart}; \node[vblue, rotate=90+\i] at (\i:3) {\faHeart}; \node[vblue, rotate=-90+\i+35] at (\i+35:3.5) {\faHeart}; \node[vblue, rotate=-90+\i-35] at (\i-35:3.5) {\faHeart}; \node[vred, scale=0.5, rotate=-90+\i+35] at (\i+35:3.5) {\faHeart}; \node[vred, scale=0.5, rotate=-90+\i-35] at (\i-35:3.5) {\faHeart}; } %The curvy lines and the I love you text \foreach\i in{0,90,180,270}{ \draw[vblue, line width=0.5mm] (\i:2.5) ..controls(\i+5:2.75) and (\i-5:3.25)..(\i:3.75); \fill[vblue] (\i:3.75)circle(0.05); \begin{scope}[shift={(\i:3.75)}] \draw[vblue,line width=0.5mm, rotate=\i+90] (0,0)..controls(0.25,-0.25)and(0.75,0.25)..(1,0); \draw[vblue,line width=0.5mm, rotate=\i+90] (0,0)..controls(-0.25,-0.25)and(-0.75,0.25)..(-1,0); \end{scope} \node[rotate=\i-90, vblue] at (\i:4.1) {\calligra I love you}; } %The inner layer \shade[inner color = vred, outer color=vblue!98] (0,0)circle(2.5); \draw[vred, line width=0.7mm] (0,0)circle(2.5); \foreach\i in{36, 72,108, ...,360}{ %The petals \draw[vred, fill=vblue] (\i:0.2)to[bend right=30](\i:0.75)to[bend right=30](\i:0.2); %The inside blue heart \node[rotate=\i-90, vblue, scale=0.95] at (\i:1.25) {\faHeart}; %The outer layer of the heart \node[rotate=\i-90, vred] at (\i:1.25) {\faHeart[regular]}; %The lines and their decorations \draw[line width=0.1mm, postaction={decorate,decoration={markings,mark=at position 1 with{\node[scale=0.25, vred, rotate=\i-90-18] {\faHeart}; }}}, vblue] (\i+18:0.25)..controls (\i+10:1.25) and (\i+18+10:1.75) ..(\i+18:2); \draw[vred, line width=0.1mm] (\i:1.5)..controls (\i-5:1.7) and (\i+5:1.8)..(\i:2); \draw[thick, vred, postaction={decorate,decoration={markings,mark=at position .75 with{ \fill[vblue] circle[radius=0.025]; }}} ] (\i:0.75)--(\i:1); } %The Kernel \draw[vred, fill=vblue] (0,0)circle(0.25); \node[vred, scale=0.75] at (-0.01,0) {\faHeart}; \end{tikzpicture} \end{document} That's cool, isn't it? So, if you were in a relationship, what creative surprises have you prepared for your partner? Alternatively, if you're in the same situation as me and just looking to kill boredom, what have you been up to? XD

  • Making symbols from *Science made Stupid*
    by davidlowryduda on November 28, 2022 at 10:24 pm

    There is a funny, award-winning book Science made Stupid that parodies gradeschool textbooks. In this book, there is the following table of symbols used in mathematics. These symbols are each made of typical symbols available in tex. But I was wondering how one might go about making these available (in math mode) in latex? I'm particularly interested in the first four — but I suspect that once any of them are made, all can be made with a bit of twiddling. It's probably possible to create the symbol in tikz, but I don't think this works well in math mode (e.g. what if I want to put "is very reminiscent of" as a subscript?). I have similar qualms about using kludge formed with rotatebox in graphicx. I suspect there are better ways.

  • Wordle-like colored letter boxes in latex
    by valerio_new on September 28, 2022 at 2:55 pm

    I want to create some letters boxed as in the Wordle game: But so far i have not found a tool that allows me to do it. I want to embed them both in the title and in the document. How would you make them?

  • Make paragraph-formatting apply to all environments but not to short paragraphs
    by anon on February 27, 2022 at 9:11 am

    I am aware that this is a hyper specific question but I have been playing around with making all paragraphs perfect rectangles just like in this StackExchange question. And as in these older threads I am experiencing the same problems. But I am still trying to make them less bad. The first problem is probably easier to fix: The changes to parfillskip and the other parameters do not take affect in any environments like enumerate and itemize in the example below. But I also want to have rectangular paragraphs there. This is probably much harder to fix and just an idea of mine. Is it possible to make the changes to the lengths only apply when the paragraph exceeds a certain length? Maybe there is some way to get the length of a paragraph to then only use the \setlength in the preamble when the length is greater than some given length. I am also aware that this is not exactly what is intended with LaTeX as the looks should be the less important part but I still want to experiment a bit with it. Here is a minimal working example which shows the problems \documentclass[a4paper]{article} \usepackage{blindtext} \usepackage{lmodern} \usepackage[stretch=30]{microtype} \usepackage{etoolbox} % Enbale rectangular paragraphs \setlength{\parindent}{0pt} \setlength{\parskip}{.5\baselineskip} \setlength{\parfillskip}{0pt} \setlength{\emergencystretch}{.5\textwidth} \makeatletter \patchcmd{\@sect}{\begingroup}{\begingroup\parfillskip=0pt plus 1fil\relax}{}{} \patchcmd{\@ssect}{\begingroup}{\begingroup\parfillskip=0pt plus 1fil\relax}{}{} \makeatother \begin{document} Too short paragraph that gets ruined and where the changed lengths should not apply \section{Lorem ipsum} \blindtext \begin{itemize} % No affect here \item \blindtext \end{itemize} \begin{enumerate} % No affect here \item \blindtext \end{enumerate} \end{document}

  • Ghost shape in TikZ/pgf
    by JeT on October 7, 2021 at 10:09 pm

    My question I can easily draw the normal distribution thanks to this answer by Jake. What about the ghost ? Context This image always breaks the ice when teaching probabilities 🙂 (Not that I care so much about it, but Halloween is getting closer too) I presume it would be possible with Inkscape (but I am not familiar with it). This answer by Paul Gaborit uses the hobby package I tried to adapt (poorly as you'll see, far too manual to be honnest) in my MWE. I'd be happy to see different approaches too (pure tikz, pgfplot, other libraries...). \documentclass[tikz]{standalone} \usetikzlibrary{hobby} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture}[use Hobby shortcut] \draw[ help lines, line width=0.1pt, blue, ] (-20, -20) grid[step={($(5, 5) - (0, 0)$)}] (60, 100); \path (0,0) coordinate (z0) (10,10) coordinate (z1) (20,0) coordinate (z2) (30,10) coordinate (z3) (40,0) coordinate (z4) (50,10) coordinate (z5) (30,90) coordinate (z6) (0,70) coordinate (z7) (0,60) coordinate (z8) ; \draw[closed,black, line width= 3mm] (z0) .. (z1) .. (z2) .. (z3) .. (z4) .. (z5).. (z6).. (z7).. (z8); \end{tikzpicture} \end{document}

  • Accessing TeX's internal tokens
    by plante on August 3, 2021 at 2:19 pm

    Section 23.7 of source3.pdf lists all possible tokens, such as the usual characters and control sequences, but also some of TeX's internal ones. Expanding \the\font results in a token that looks identical to the command that was used to select the current font (such as \tenrm) but it differs from it in shape. A “frozen” \relax, which differs from the primitive in shape (but has the same meaning), is inserted when the closing \fi of a conditional is encountered before the conditional is evaluated. Expanding \noexpand <token> (when the <token> is expandable) results in an internal token, displayed (temporarily) as \notexpanded: <token>, whose shape coincides with the <token> and whose meaning differs from \relax. An \outer endtemplate: can be encountered when peeking ahead at the next token; this expands to another internal token, end of alignment template. Tricky programming might access a frozen \endwrite. Some frozen tokens can only be accessed in interactive sessions: \cr, \right, \endgroup, \fi, \inaccessible. How can I produce these tokens, either by \letting them to another control sequence, a macro containing one, or simply "seeing" them in some form?

  • Bo Derek in texbook.tex?
    by Ulrich Diez on November 9, 2019 at 5:47 pm

    texbook.tex contains a double-dangerous-bend exercise which starts at line 18198 : \ddangerexercise ^{Powers of ten}: The whole \TeX\ language has now been summarized completely. To~demonstrate how much you know, name all of the ways you can think of in which the numbers 10, ^^{Derek, Bo} 100, 1000, 10000, and 100000 have special significance to \TeX. Why can you find the sequence ^^{Derek, Bo} within that snippet? Why does texbook.tex, Appendix I. Index (line 26324) also hold an entry Derek, Bo, 293.? If I get this right, Bo Derek is an American film and television actress, and the name "Bo Derek" seems not to occur at all in the text of the TeXbook, only in the index. Why? Addendum: Section 7 - My sense of humor of "Donald Knuth Interview 2006" on GitHub provides some insights. There is also a video of this interview. 😉

  • Draw arrows from reference to figure
    by Thorbjørn E. K. Christensen on July 18, 2019 at 6:00 am

    I just fell over this gem of a figure reference system in the Danish on train magazine "ud & Se" (out and watch), and I wondered if there was a way of doing it in LaTeX. The idea is, that instead of using a caption, and reference by number, the text referencing a figure will be emphasized (bold, underlined or both) and an arrow will be drawn from the bottom center of the text to the figure. The arrow can be either curved (as in the picture below) or move in cardinal directions, if the latter is the case, the arrow should avoid text while moving horizontally, but collide with text when moving vertically (at least that's what the magazines do) Pic: I guess the way to do this in LaTeX would be something like overlaying a tikzpicture which has both the figure and the reference, and then drawing an arrow, but I don't really know anything further than that. I realize that the feature is mostly useless, but it would be fun for gags (I can see it used in my student magazine as a joke)

  • Welcoming 2019 Lunar New Year: How to draw a (lovely) pig?
    by user156344 on February 4, 2019 at 8:52 am

    Chinese Zodiac and Lunar Year can be called very close friends. In Eastern cultures, each lunar year is assigned to one of the twelve animals in Chinese zodiac. The animal (or rather a mascot) of this year is the pig. So, my question in this question is: How to draw a (lovely) pig in LaTeX? I found a very beautiful picture on TeXample: % Author M.R.C. van Dongen % Draw parameterised pig. % This code can/should be improved by using the pgfkey library. \documentclass{minimal} \usepackage{tikz} \usetikzlibrary{calc} \usepackage{keyval} \makeatletter % We're not using pgfkeys, and we've chosen to use keyval % for option parsing. The following define the keys for a % pig keyval family. The main purpose of the keys and % default values is that we want to be able to draw pigs % with predefined colours for certain parts and predefined % scaling factors for line thickness. \def\pig@draw@thick@width{0.85} \def\pig@draw@thin@width{0.20} \def\pig@label{pig label} \tikzset{draw thick/.style={draw=black,line width=0.85}} \tikzset{draw thin/.style={draw=black,line width=0.20}} \tikzset{fill colour/.style={fill=pink}} \tikzset{nose hole fill colour/.style={fill=purple!50!gray}} \tikzset{eye fill colour/.style={fill=white}} \tikzset{pupil fill colour/.style={fill=black}} \define@key{pig}{draw thick}{\def\draw@pig@thick@width{#1}} \define@key{pig}{draw thin}{\def\draw@pig@thin@width{#1}} \define@key{pig}{fill colour}{\tikzset{fill colour/.style={fill=#1}}} \define@key{pig}{nose hole fill colour}{\tikzset{nose hole fill colour/.style={fill=#1}}} \define@key{pig}{eye fill colour}{\tikzset{eye fill colour/.style={fill=#1}}} \define@key{pig}{pupil fill colour}{\tikzset{pupil fill colour/.style={fill=#1}}} \define@key{pig}{pig label}{\def\pig@label{#1}} \def\pig@scale{1} \def\pig{\@ifnextchar[\draw@pig{\draw@pig[]}} \def\draw@pig[#1]#2{% % Set the relative line width for thick lines. \def\draw@pig@thick@width{0.85} % Set the relative line width for thin lines. \def\draw@pig@thin@width{0.20} % Set the relative scale of the pig. \def\pig@scale{#2} \setkeys{pig}{#1} \begin{tikzpicture}[scale=#2, draw thick/.style={draw=black,line width=\draw@pig@thick@width*\pig@scale}, draw thin/.style={draw=black,line width=\draw@pig@thin@width*\pig@scale}] \path (0,0) coordinate (\pig@label head) + (-0.005,-0.20) coordinate (\pig@label nose) + (-0.010,+0.05) coordinate (\pig@label body) + (-0.010,+0.45) coordinate (\pig@label tail); % Define points for tail. \foreach \number/\point in {1/{+0.000,+0.055},% 2/{-0.058,+0.075},% 3/{+0.044,+0.094},% 4/{-0.072,+0.137},% 5/{+0.048,+0.170},% 6/{-0.078,+0.206}} { \path (\pig@label tail) +(\point) coordinate (tail \number); } % Define points for ears and legs. \foreach \offset in {-1,1} { \path (\pig@label head) ++ (+0.12*\offset,+0.00) coordinate (ear pt 1 \offset) + (-0.04*\offset,+0.07) coordinate (ear pt 2 \offset) + (-0.02*\offset,+0.25) coordinate (ear pt 3 \offset) + (+0.11*\offset,+0.25) coordinate (ear pt 4 \offset) + (+0.14*\offset,+0.13) coordinate (ear pt 5 \offset) + (+0.09*\offset,-0.06) coordinate (ear pt 6 \offset) (\pig@label head) ++ (+0.09*\offset,-0.30) coordinate (leg 1 \offset) ++ (+0.01*\offset,-0.24) coordinate (leg 2 \offset) ++ (+0.04*\offset,+0.08) coordinate (leg 3 \offset) ++ (+0.04*\offset,-0.08) coordinate (leg 4 \offset) ++ (+0.02*\offset,+0.30) coordinate (leg 5 \offset); } % draw legs. \foreach \number in {-1,1} { \filldraw[fill colour,draw thick] (leg 1 \number) -- (leg 2 \number) -- (leg 3 \number) -- (leg 4 \number) -- (leg 5 \number) -- cycle; } % draw tail. \draw[draw thick,line join=round,line cap=round] (\pig@label tail) \foreach \num in {1,...,6} { -- (tail \num)}; % draw body. \draw[fill colour,draw thick] (\pig@label body) ellipse (4.50mm and 4.10mm); % draw ears. \foreach \number in {-1,1} { % ears \filldraw[fill colour,draw thick] (ear pt 1 \number) .. controls (ear pt 2 \number) and (ear pt 3 \number) .. (ear pt 4 \number) .. controls (ear pt 5 \number) and (ear pt 6 \number) .. (ear pt 1 \number); } % draw nose. \filldraw[fill colour,draw thick] (\pig@label head) ellipse (1.42mm and 1.40mm); \foreach \offset in {-1,1} { \filldraw[draw thin,eye fill colour] (\pig@label head) ++ (-0.006,0.00) ++ (0.055*\offset,+0.03) coordinate (eye \offset) ellipse (0.04 and 0.060); \fill[pupil fill colour] (eye \offset) ellipse (0.020 and 0.035); } \filldraw[fill colour,draw thick] (\pig@label nose) ellipse (2.60mm and 1.72mm); % Draw nose holes \foreach \offset in {-1,1} { \filldraw[draw thick,nose hole fill colour] (\pig@label nose) ++ (\offset*0.080,0) ellipse (0.50mm and 0.85mm); } \end{tikzpicture} } \makeatother \begin{document} \begin{tikzpicture} \draw (0,0) node[anchor=south]{\pig{3}} (4,0) node[anchor=south]{\pig[nose hole fill colour=purple!20,fill colour=blue!40]{5}}; \end{tikzpicture} \end{document} However, I wish to see more pigs here, especially with other familiar animals, like lions, ducks, marmots, bears, rabbits, birds, donkeys, or penguins. I am also looking for a tikzlings pig!

  • TikZ and FIFA WorldCup 2018: Flags of Nations
    by Black Mild on June 26, 2018 at 5:19 pm

    I am a kind of TikZ addict, and also be a fan of football. This time - WorldCup 2018 - is nice change of relaxing by drawing flags of 32 football teams by pure TikZ or TikZ-based codes. Some are easy (like the Japan flag ^^), some are somehow difficult! Please join and/or suggest me! Let me start with the South-Korean flag. In its code, I like the way of (i) drawing the Yin Yang symbols and the 4 black trigrams via only one parameter \YYrotation; (ii) using scope, foreach, and (iii) using a trick of coloring black/white trigrams with a little bit bigger line width. I first draw trigrams at (0,0), then use rotation and shift to move to the corners. Description of the South-Korean flag can be found here https://en.wikipedia.org/wiki/Flag_of_South_Korea The followings are the TikZ codes for the South-Korean flag. % Description of The SOUTH-KOREAN FLAG % https://en.wikipedia.org/wiki/Flag_of_South_Korea % A rectangle: width = 2/3 length, % the Yin Yang symbol (red above, blue below) at center, % the 4 black trigrams at 4 corners. \documentclass[border=5mm]{standalone} \usepackage{tikz} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \def\a{7.5} % a half of the length \def\b{5} % a half of the width \def\r{1.25} % radius of the Yin/Yang symbol % radius of the big circle \pgfmathsetmacro{\R}{2*\r} % the rotation angle of Yin/Yang/trigrams \pgfmathsetmacro{\YYrotation}{atan(3/2)} % the whole rectangle of the flag \path (-\a,-\b) rectangle (\a,\b); % the Yin Yang symbol: draw, then rotate \begin{scope}[rotate=\YYrotation] \fill[red] (0,\R) arc (90:-90:\R) arc(-90:90:\r) arc(270:90:\r); \fill[blue] (0,-\R) arc (270:90:\R) arc(90:270:\r) arc(90:-90:\r); \end{scope} % the spring trigram (the above-left corner) \begin{scope}[rotate=\YYrotation,shift={(0,4.6)},line width=.42 cm] \foreach \j in {0,5/8,-5/8} \draw (-5/4,\j)--(5/4,\j); \end{scope} % the autumn trigram (the below-left corner) \begin{scope}[rotate=-\YYrotation,shift={(0,-4.6)},line width=.42 cm] \foreach \j in {0,5/8,-5/8} \draw (-5/4,\j)--(5/4,\j); \draw[white,line width=.44 cm] (-5/48,0)--(5/48,0); \end{scope} % the winter trigram (the above-right corner) \begin{scope}[rotate=-\YYrotation,shift={(0,4.6)},line width=.42 cm] \foreach \j in {0,5/8,-5/8} \draw (-5/4,\j)--(5/4,\j); \foreach \j in {5/8,-5/8} \draw[white,line width=.44 cm] (-5/48,\j)--(5/48,\j); \end{scope} % the summer trigram (the below-right corner) \begin{scope}[rotate=\YYrotation,shift={(0,-4.6)},line width=.42 cm] \foreach \j in {0,5/8,-5/8} \draw (-5/4,\j)--(5/4,\j); \foreach \j in {0,5/8,-5/8} \draw[white,line width=.44 cm] (-5/48,\j)--(5/48,\j); \end{scope} \end{tikzpicture} \end{document}

  • "The duck pond": showcase of TikZ-drawn animals/ducks
    by TeXnician on August 18, 2017 at 2:02 pm

    We have tons of nice TikZ-drawn pictures on this site. Among them some great pictures of animals like cfr's cat code. But they are distributed all over the site. As we definitely miss a place to collect them, this post asks about nice examples of animals/pets drawn with TikZ. Especially those pictures about ducks are welcome. For all of the duck friends, quack! Please do not close this question too early (I know it's a bit out-of-concept here, but there are other well-known showcases).

  • Given a list of primes, how can I plot π(x)?
    by Sean Allred on January 10, 2016 at 2:37 am

    Given an arbitrarily-long list of primes (or any sequence, I suppose), I'd like to calculate and plot the pairs (x, count of numbers in my list less than or equal to x) Bonus points for skipping the 'input a list of primes step' and using How to produce a list of prime numbers in LaTeX 🙂 But, you can assume that input is an ordered, comma-separated list (i.e. a clist) of prime integers. Of course, any input easier than that is also an option. MWE \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=1.12} \begin{document} \begin{tikzpicture} \begin{axis}[ title={The prime counting function: $\pi(x)$}, xlabel=$x$, ylabel=$\pi(x)$, ] \addplot[only marks] table { x primes 0 0 % 0 is not prime; we have (0 primes ≤ 0) 1 0 % 1 is not prime; we have (0 primes ≤ 1) 2 1 % 2 is prime; we now have (1 prime ≤ 2) 3 2 % 3 is prime; we now have (2 primes ≤ 3) 4 2 % 4 is not prime; we have (2 primes ≤ 4) 5 3 % etc. 6 3 7 4 8 4 9 4 10 4 }; \end{axis} \end{tikzpicture} \end{document} Instead of providing π(x) manually like this, I'd like to just provide a list of primes in a text file or a clist. As always, brownie points for generality 🙂 Note that, per fun, I'm looking for a pure TeX solution – but all solutions (besides the trivial \includegraphics) are welcome 🙂

  • How can we make a pumpkin, jack-o-lantern, or other halloween spirit, ghoul, or skeleton?
    by A.Ellett on October 31, 2014 at 7:04 pm

    We have questions about Christmas trees and Hearts for Valentines but we have no questions that specialize in Halloween or Dia de los Muertos art. Here it goes: Using TikZ or PSTricks or any other of your favorite LaTeX tools, create pumpkins, ghouls, etc., appropriate to the season. I think multiple submissions should be fine provided different objects are created.

  • How compose an image from a specific text?
    by rigor on June 6, 2014 at 7:17 am

    I love playing around with ASCII art and, as you may know, there are tools to generate ASCII art from images, where the ASCII consists of those characters which will result in the best image, as this first picture shows: With the eye, you need ASCII characters with a lot of white (e.g. dots, commas, hyphens) to generate the brighter areas and characters with a lot of black (e.g. M, $) to generate darker areas. Now, what I want to achieve is being able to control the characters which make up the image. An example which is halfway there is the following image, where the story forms the shape of a raven. However, this raven is only flat, with no depth like the eye has. I would like to combine the examples with the eye and the raven. Would it be possible to achieve the same kind of effect in LaTeX either by using different shades of grey, or by using different sizes, for each individual character? So, for brighter areas, use a light grey or small black character, and for darker areas, use black and large characters. Does this make sense? Is it possible to achieve in an automatic way with LaTeX?

  • Nice scientific pictures show off
    by Thomas on February 5, 2014 at 8:40 am

    Task Show off your best scientific illustration ! The main purpose of this question is to share beautiful scientific pictures, preferably with an educational aspect. Content Your post must contain a nice picture and the associated code. One can post several pictures, but it must be done in different replies. Of course, it must be done with LaTeX & Friends : the post must start with a short sentence to present the language that you chose (TikZ, Asymptote ...) and the main packages that helped you to make the picture. Don't hesitate to add comments. Reward The satisfaction to share without expecting a reward 🙂 Ok ... 300 points reputation bounty for the best up-voted post until the 15th of Feb. Related links I'll contact Texample.net webmaster to see if he is interested to share the best illustrations, with the participant's agreement of course. Contest: Show Off Your Skillz in TeX & Friends

  • How can I make (some) $money$ out of my TeX skills?
    by jub0bs on September 27, 2013 at 12:46 am

    I by no means intend to stop contributing what I can to TeX.SE, but a recent experience begs the question... After helping a friend designing a flyer for a telecom company (for which she got decent remuneration), I find myself wondering whether there is a market for freelance TeX-related jobs, on which I could perhaps make some extra bucks for rainy days. As an amateur TeXnician with limited general knowledge of graphic design, but with a growing portfolio of decent-looking documents produced with TeX & friends, Who, if anyone, should I attempt to sell my TeX skills to? Would, say, a publishing company be interested? Or do they generally seek people with a much stronger background in TeX & friends than mine? If you are directly getting paid on account of your TeX skills, how did you get started? Note: I'm not sure whether this question is more appropriate on meta or on the main site. Feel free to migrate it, if necessary. It may be also be more suited as a community wiki, but I feel this isn't my call.

  • Showcase of optical illusions made with TeX/LaTeX/LuaTeX/ConTeXt
    by Gonzalo Medina on August 20, 2013 at 7:59 pm

    Optical illusions are fun, so I thought it would be a good idea to have a list of optical illusions designed using MetaPost, or PGF/TikZ, or PS-Tricks, or Asymptote. Each entry should display one optical illusion and the code necessary to produce it.

  • TeX – LaTeX in pop culture
    by f.boc on June 24, 2013 at 2:33 pm

    I'm doing a research on free-software references in movies, TV series, etc. Things like: "In Dr. House they use KDE as DE" or "Sheldon from the The Big Bang Theory uses Ubuntu." And the like. I'd love to include some TeX/LaTeX facts, but I've not managed to find any reference. Can you help me? Only restriction is that the movie/TV series etc. must be in English. I didn't know where to put this question so went for fun. Hope you don't mind this sort of questions, please forgive me if this is not allowed.

  • What is the most bizarre thing you have seen done with TeX
    by Xavier on March 25, 2013 at 6:49 pm

    I think the questions says it all! 🙂 By TeX, I mean any derivative of TeX as long as the code is clearly a derivative of TeX, i.e. that it could belong on TeX.SX (and not pure Lua for example). I'll give two answers myself so you see what I mean.

  • How to create a Caesar's encryption disk using LaTeX
    by Uwe Ziegenhagen on March 20, 2013 at 5:47 am

    How can I create a Caesar's encryption disk with LaTeX? I guess, the ultimate solution would take a arbitrary list of letters and calculate the spaces and angles for each letter automatically. So if I pass 4 letters to it, each space should have 90 degrees.

  • How can I draw an egg using TikZ?
    by Alex Grilo on September 26, 2012 at 12:36 pm

    I would like to draw an egg-format element, but I have only found ways of drawing ellipses.

  • How can we draw a Christmas tree with decorations, using TikZ?
    by Stefan Kottwitz on December 22, 2011 at 10:04 pm

    I would like to use TikZ for drawing a christmas tree. Here's a start, I used the lindenmayersystems library for drawing a tree: \documentclass{article} \usepackage{tikz} \usetikzlibrary{lindenmayersystems} \begin{document} \begin{tikzpicture} \draw [color=green!50!black, l-system={rule set={S -> [+++G][---G]TS, G -> +H[-G]L, H -> -G[+H]L, T -> TL, L -> [-FFF][+FFF]F}, step=4pt, angle=18, axiom=+++++SLFFF, order=11}] lindenmayer system -- cycle; \end{tikzpicture} \end{document} I found the tree in "The Science of fractal images" by Peitgen and Saupe. Who can help to decorate it? Or to draw another tree with Christmas decorations, such as tinsel garland (lametta), candles, baubles (Christmas balls), a tree topper? Perhaps add a shading to the green? For celebrating Christmas, I would like to put the tree on our blog, and on the TikZ example gallery.