2022 Developer Survey is open! Take survey.
10 votes
Accepted

What is the best way to draw an arbitrary number of lines in LaTeX?

It is not necessary to use multido when tikz is loaded. Just use \foreach: \documentclass[12pt]{memoir} \usepackage{tikz} \newcommand{\linespace}{6mm} \newcommand{\drawlines}[1]{\tikz{\foreach \n ...
user avatar
  • 20.3k
9 votes
Accepted

Subgroup diagram of $S_3$

Like this? \documentclass[12pt]{article} \usepackage{tikz} \usetikzlibrary{arrows.meta, calc, chains } \begin{document} \begin{figure} \centering \begin{...
user avatar
  • 251k
7 votes
Accepted

Best method to animate a step by step state space diagram construction in TikZ

An off-beamerclass \uncover command is defined, that specifies the frame number at which an object in a tikzpicture is to be revealed. %\uncover{<current>}{<when>}{...<commands>...} \...
user avatar
  • 50.9k
7 votes

Best method to animate a step by step state space diagram construction in TikZ

I don't know if this is ideal for you. Because I change some of your tikz code in order to use a absolute coordinate for each path. In this way, each individual path can be drawn without reference the ...
user avatar
  • 1,893
7 votes

Subgroup diagram of $S_3$

You get a more symmetric diagram if you change the order of the subgroups: \documentclass[12pt]{article} \usepackage{tikz-cd} \begin{document} \begin{figure} \centering \begin{tikzcd}[ row sep=...
user avatar
  • 986k
6 votes

Subgroup diagram of $S_3$

Or using tikz-cd: \documentclass[12pt]{article} \usepackage{tikz-cd} \title{Subgroup Diagram of $S_3$} \begin{document} \begin{figure} \centering \begin{tikzcd}[row sep= 1em,column sep=1em] & ...
user avatar
  • 46.2k
6 votes
Accepted

Draw the flat torus

Here's an option. I defined a command \flattorus with three arguments: (optional) The side of the square in the TikZ picture, in cm. I put 4 as the default value, but of course you can easily change ...
user avatar
  • 15.4k
6 votes
Accepted

How can I draw rectangle with empty fraction?

We can define a macro \fracrect that draws the rectangle. The command is \fracrect[tikz options]{numerator}{denominator} For example, \fracrect[xscale=4]{9}{12} will be similar to your second divided ...
user avatar
  • 20.3k
5 votes

What is the best way to draw an arbitrary number of lines in LaTeX?

A fairly general method for repeating things a given number of times, using also the corresponding index. \documentclass[12pt]{memoir} \ExplSyntaxOn \NewDocumentCommand{\REPEAT}{mm} {% #1 = number ...
user avatar
  • 986k
5 votes
Accepted

Drawing a Pyramid within a Rectangular with Arrows and Text

Doing this for entertainment :) \documentclass[tikz,border=15pt]{standalone} \usepackage{fontspec} \usepackage{newtxtext} \setsansfont {texgyreheros} [ Scale = MatchUppercase , ...
user avatar
  • 5,109
4 votes
Accepted

Interface for diagrams and example

It's true—TikZ can be intimidating at first. The 1000+ page manual is downright terrifying. But it's worth it! Start with some of the tutorials at the beginning of the manual. You'll be drawing ...
user avatar
  • 20.3k
4 votes

Draw the flat torus

A nice solution was posted by @Vincent (+1) but this was already in the works so I figured I'd post it as an alternative. Here is a macro \flattorus that takes two arguments (and one additional ...
user avatar
  • 20.3k
4 votes

Best method to animate a step by step state space diagram construction in TikZ

One more suggestion: replicate animation as is done in MWE in question simplified styles of tikzpicture elements shorter and simpler code \documentclass[border=2mm]{standalone} \usepackage{amsmath,...
user avatar
  • 251k
4 votes
Accepted

How can I draw Circular sector with three empty fraction?

Modify the code from the solution about rectangles but use circular sectors: The code for the above image is \fraccirc{9}{12}\qquad\fraccirc[fill=blue!30]{3}{4}. The default fill color is orange!70, ...
user avatar
  • 20.3k
3 votes

Subgroup diagram of $S_3$

The TikZ graphs and graphdrawing libraries are nice for this as well (see also "Part IV Graph Drawing" of the pgfmanual). One caveat is the requirement of LuaLaTeX for graphdrawing, since ...
user avatar
  • 31
3 votes

Interface for diagrams and example

A small variation of the nice @Sandy G answer (+1) which gives wee bit shorter code. For exercise :-) \documentclass[border=3.14159]{standalone} \usepackage{tikz} \usetikzlibrary{arrows.meta, ...
user avatar
  • 251k
3 votes

What is the best way to draw an arbitrary number of lines in LaTeX?

A LaTeX3 version using \rule (based on Skillmon's answer) \documentclass{article} \usepackage{xcolor} \ExplSyntaxOn \int_new:N \g_dl_line_count \NewDocumentCommand{\drawlines}{ m }{ \int_set:Nn \...
user avatar
  • 2,410
3 votes

What is the best way to draw an arbitrary number of lines in LaTeX?

It is not necessary to use TikZ for this, you could also use LaTeX's built in \rule: \documentclass[12pt]{memoir} \usepackage{xcolor} \makeatletter \newcommand\drawline[1] {\expandafter\drawline@\...
user avatar
  • 48.7k
3 votes
Accepted

Drawing not simply connected domain

You are overcomplicating this. Draw all three closed curves with one \draw command using even odd rule to fill the area between the curves. Decorate with arrows and labels using \node in the ...
user avatar
  • 20.3k
3 votes
Accepted

Right triangle with angle

Try this \documentclass[border=5mm]{standalone} \usepackage{asymptote} \begin{document} \begin{asy} size(300); pair A = (0,0); pair B = dir(18); pair C = (xpart(B), 0); draw (A--B--...
user avatar
  • 35.8k
3 votes
Accepted

Using xy-diagram to create an asymmetrical triangle

Here is the diagram with xy. Note that I loaded cmtip which makes proper arrowheads. You are permitted to have empty cells, so simply remove the B from the top left entry (but leave the &. \...
user avatar
  • 20.3k
3 votes
Accepted

How can I create a Gantt / Sankey diagram combination?

Some comments I think a solution for the diagram you are looking for can be achieved using only the positioning library: I organized all the elements of the drawing around the empty cell in the upper ...
user avatar
  • 2,859
3 votes
Accepted

Tree Diagram with Filesystem Branches

This can be done with forest, but it requires some manual adjustment because of the way the folder style interacts with the standard style. \documentclass{article} \usepackage[edges]{forest} \...
user avatar
  • 20.3k
3 votes

How can I draw rectangle with empty fraction?

Add another solution using rectangle nodes and put everything in a single tikzpicture which can be drawn by a command (e.g. \fracrect{3}{7}{6}{14}). \documentclass{article} \usepackage{tikz} \...
user avatar
  • 1,893
2 votes
Accepted

move nodes manually in tikzpicture

Remember that the positioning library allows you to place relative nodes to others with displacements in all directions using above/below left/right = above/below_displacement and left/...
user avatar
  • 10.3k
2 votes

move nodes manually in tikzpicture

\documentclass{article} \usepackage{tikz} \usetikzlibrary{positioning,calc} \begin{document} \begin{tikzpicture}[auto, node distance = 0.4cm, thick, every node/.style = {rectangle, font = \sffamily,...
user avatar
  • 2,410
2 votes

Tree Diagram with Filesystem Branches

your question is not clear, sorry. your other image is simple to draw by use of forest package: \documentclass[border=0.2 cm]{standalone} \usepackage[edges]{forest} \usetikzlibrary{arrows.meta} \...
user avatar
  • 251k
2 votes

Creating a bent 3D pipe in Tikz

Not sure if this is exactly what you're looking for, but you can \draw an arc with option double and place ellipses at each end. Note the double distance should account for the line thickness to get a ...
user avatar
  • 20.3k
2 votes
Accepted

Why does my text along the line intersect nodes?

Huh, your MWE is very (to my opinion unnecessary) complex (consequently in it can be easily lost) My suggestion is mostly off-topic -- possible solution is already mentioned in @SebGlav comment -- ...
user avatar
  • 251k
2 votes

drawing a transition state integrated in a matrix

I happened to have an example of how to color specific pairs of coordinates with NiceTabular using \CodeAfter. The loop in \foreach uses evaluate=\x as \i using {int(\x+2)} in order to correct the ...
user avatar
  • 3,092

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