Skip to main content

New answers tagged

1 vote

Triangle with text

\documentclass[border=.5cm]{standalone} \usepackage[mini]{tkz-euclide} \usepackage{tkz-elements} \begin{document} \begin{tkzelements} scale = 1 z.A = point : new ( 0 , 0 ) z.B = point ...
Alain Matthes's user avatar
1 vote
Accepted

How to save coordinates from paths

You can simply add e.g. coordinate (D) at the end of the path to name a coordinate at that spot. \documentclass[border=5pt]{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} \...
cfr's user avatar
  • 208k
1 vote

NiceMatrix + Tikz Determinants Picture

Just for fun and learning, an option using tikz matrix, then through code nested in definitions with parameters, taking advantage of the calc library you can obtain the angle between 2 points, then ...
J Leon V.'s user avatar
  • 12.9k
5 votes
Accepted

How to move the color blocks into the red frame region marked?

You can take advantage of the node names and the remember picture option, that way in a tikz picture environment with the overlay option you can draw whatever using points relative to the node name ...
J Leon V.'s user avatar
  • 12.9k
5 votes

How to move the color blocks into the red frame region marked?

Made entirely with TikZ, even though it doesn't suit you. \documentclass[aspectratio=2013]{beamer} \usepackage{tikz,subcaption} \usetikzlibrary{positioning} \tikzset{legend/.style={fill=#1,minimum ...
AndréC's user avatar
  • 26k
2 votes

Tikz: How to vertically align text across multiple nodes?

The tcolorbox package does this natively. Here I'm using the fitting library, which gives tcolorboxes fixed dimensions. To space them, I've placed jumps \hspace{1cm}. \documentclass{article} \...
AndréC's user avatar
  • 26k
5 votes
Accepted

Problem with add/.style in tkz-euclide

A to path operation is – at its core – just an expansion of whatever is stored in to path. That means your path \draw[line style,#1] (#2) to (#3); just becomes \draw[line style,#1] (#2) ($(#2)!…!(#3)...
Qrrbrbirlbel's user avatar
1 vote
Accepted

Strange extra arrow behavior in tikz because xshift

In this case, the tips=proper key is used to draw arrows only where they are required. \documentclass{article} \usepackage{tikz} \usetikzlibrary{bending, arrows, arrows.meta} \begin{document} \begin{...
AndréC's user avatar
  • 26k
4 votes
Accepted

Customizable Vertical Rule / Divider Like `\vrule` With Automatic Height

Answer to revised question To do this in arbitrary contexts, you need to have a self-sufficient way of measuring the height and depth of the content on each side of the rule. The most straightforward ...
cfr's user avatar
  • 208k
0 votes

Date format option not working on genealogytree

I didn't look into the package to figure out why, but it works if you define the date format after \begin{document}. \documentclass[tikz]{standalone} \usepackage[all]{genealogytree} \gtrset{ ...
cfr's user avatar
  • 208k
0 votes

Modification of exam `answer plot` to allow drawing partial opacity when `\printanswers` is uncommented

You can use \if \else \fi inside a tikzpicture. \printanswers sets \ifprintanswers. \documentclass{exam} \usepackage{amsmath} \def\bm#1{\mathbf{#1}} \def\paren#1{(#1)} \usepackage{pgf,tikz} \...
John Kormylo's user avatar
  • 81.2k
0 votes

Modification of exam `answer plot` to allow drawing partial opacity when `\printanswers` is uncommented

Here's a solution I came up with that defines two styles, answer plot and answer fill. It does the trick for now. Let me know if you think there's a better way. \documentclass{exam} \usepackage{pgf,...
EthanAlvaree's user avatar
  • 1,421
1 vote
Accepted

How to create a command to plot a series of square lattices on a given line?

You can use LaTeX3 to define a parser \meiu_range_to_list:nN \seq_new:N \l__meiu_tmpa_seq \seq_new:N \l__meiu_tmpb_seq \clist_new:N \l__meiu_tmpa_clist \cs_set_nopar:Npn \meiu_range_to_list:nN #1#2 {...
ljguo's user avatar
  • 1,412
4 votes

Creating the projective plane PG(2,3) (picture included) using tikz

Here is a version that allows for labelling of the nodes: \documentclass[letterpaper]{article} \usepackage{tikz} \begin{document} \begin{tikzpicture}[ every node/.style={fill=black,circle, text=...
Tim's user avatar
  • 71
3 votes

Drawing an affine plane in latex

And here is a complete version: \documentclass[letterpaper]{article} \usepackage{tikz} \tikzset{node distance=2cm, every node/.style={circle,thin, fill=black}} \begin{document} \begin{tikzpicture} ...
Tim's user avatar
  • 71
0 votes

How to create a command to plot a series of square lattices on a given line?

If you don't mind staying with the TikZ syntax for the loop: \documentclass[tikz]{standalone} \newcommand\sqrs[2]{% \foreach \x in {#2}% \fill[#1] (\x,12) rectangle+ (-1,-1);} \begin{...
MS-SPO's user avatar
  • 13.8k
2 votes

How do I make the text bend along the function using tikz if possible?

Approaches: Guessing the positions. (They are not linear to the x value.) Taking inspiration from https://tex.stackexchange.com/a/88421/16595 we can combinate the fillbetween library and place a node ...
Qrrbrbirlbel's user avatar
3 votes
Accepted

How can I get `f(2/3) = 20/9` and `f(4/3) = 16/9` of the function f(x) = 3 *x^3 - 9*x^2 + 8*x when I use pgf/tikz

Below, a key declare xintexpr function is defined. This must be a function of one variable named \x. It will define the function for pgfmath and also for \xintdeffunc. Also a key number format/...
matexmatics's user avatar
  • 5,399
1 vote

tikz diagram skier on a slope

is it possible to reproduce this schema with tikzpicture ? Yes, as you've seen already. Here is a way to do it via my answer in comment A) 1. Get an image So I found an uphill skier on a sign. Cur it ...
MS-SPO's user avatar
  • 13.8k
0 votes

tikz diagram skier on a slope

is it possible to reproduce this schema with tikzpicture ? Yes, as you've seen already. Here is a way to do it via my SVG suggestion C) Now, this one is simple, as it has been asked and answered ...
MS-SPO's user avatar
  • 13.8k
1 vote

tikz diagram skier on a slope

is it possible to reproduce this schema with tikzpicture ? Yes, as you've seen already. Here is a way to do it via my scribble suggestion B) 1. Scribble the skier uphill I did what I wrote: sketched ...
MS-SPO's user avatar
  • 13.8k
1 vote

Checking if the version of TikZ is newer in a format-independent way

This here implements a general loop which compares two different version numbers. The following syntax is supported: Parts of the version number are separated by a dot. In the expected version number ...
Skillmon's user avatar
  • 61.6k
3 votes
Accepted

Checking if the version of TikZ is newer in a format-independent way

A somewhat elegant test for your use case which supports a hardcoded number of 3 digits, and uses your split result. I also used the \pgfutil@ since you're loading pgf anyway and that provides \@...
Skillmon's user avatar
  • 61.6k
1 vote

NiceMatrix + Tikz Determinants Picture

A solution with pic \documentclass[border=5mm]{standalone} \usepackage{amsmath} \usepackage{tikz} \usepackage{nicematrix} \begin{document} $ \begin{NiceArray}{*{5}{>{\mathstrut}c}}[columns-width=...
polyn's user avatar
  • 5,854
2 votes

tikz diagram skier on a slope

As suggested by SamCarter... \documentclass{article} \usepackage{tikz}%,pgf} %\usepackage{pgfplots} %\usetikzlibrary{calc,angles} \usetikzlibrary{angles} %\usetikzlibrary{arrows} %\usetikzlibrary{...
John Kormylo's user avatar
  • 81.2k
13 votes
Accepted

tikz diagram skier on a slope

The boring solution: use a skier from the fontawesome5package: \documentclass{article} \usepackage{tikz}%,pgf} %\usepackage{pgfplots} %\usetikzlibrary{calc,angles} \usetikzlibrary{angles} %\...
samcarter_is_at_topanswers.xyz's user avatar
1 vote
Accepted

Center Tikz pictures used as tick labels in Pgfplots

You have several spaces in the piechart. I can not recommend doing this as it nest tikzpictures. It might be done with a path picture or simply drawn afterwards. \documentclass{article} \usepackage{...
hpekristiansen's user avatar
0 votes

TikZ-PGF surface edges smoothing

There is no automatic way to avoid that problem - the function is evaluated on a regular mesh. Here is one way to get a better result: \documentclass[tikz, border=1cm]{standalone} \usepackage{pgfplots}...
hpekristiansen's user avatar
2 votes
Accepted

Tikz graphs not aligned

See if the following MWE givers what you after. In it I reduce preamble to loading only to your problem relevant packages (geometry, pgfplots (version 1.18), subcaption) from diagram code remove ...
Zarko's user avatar
  • 300k
5 votes
Accepted

PGFPlots library fillbetween causing a bunch of "Missing Character" warnings

This has been reported and fixed in the development version: https://github.com/pgf-tikz/pgfplots/issues/456 Basically you have to use \ifdim instead of \ifnum in an internal command: \documentclass[...
Ulrike Fischer's user avatar
2 votes
Accepted

Two for loops and the second starts with i+1

You could just do \foreach[count=\ii from 1] \i in {2,...,#1} { \foreach \j in {1,...,\ii} { which removes any necessity for calculating anything by letting the loop count an offset to \i. You can ...
Qrrbrbirlbel's user avatar
3 votes
Accepted

Reproducing the lichess opening tree stat bar

You did not explain much about how exact the output should match the picture you provide, but something like this could be a starting point (the thin white lines in the output are rendering errors): \...
Jasper Habicht's user avatar
3 votes
Accepted

Strange rendering of 3d surface with pgfplots

Changing what is a possible error in your equation gives the expected result (so it is not the exact same equation): \documentclass[tikz, border=1cm]{standalone} \usepackage{pgfplots} \pgfplotsset{...
hpekristiansen's user avatar
3 votes
Accepted

add customize line header not smooth connected

Ultimately, I think for big arrow tips, simply drawing a white shortened lines on top of the normal line including the bending library and a sep instead of the shorten keys will lead to nicer looking ...
Qrrbrbirlbel's user avatar
2 votes

modify shorten value for inner draw command

What happens is that postaction is independent of the properties that you add later, if you want them to affect what is in postaction you must do it through an additional variable, in this case I ...
J Leon V.'s user avatar
  • 12.9k
4 votes

add customize line header not smooth connected

Different approach: draw two arrows above each other \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{arrows.meta} \begin{document} \begin{tikzpicture} \coordinate (A) at (0,0); ...
samcarter_is_at_topanswers.xyz's user avatar
5 votes
Accepted

Naming tikz pics doesn't work on v.3.1.10

Since version v3.1.10 TikZ includes both name prefix and name suffix for the local bounding box. Since the pic's name is appended to the name prefix this would be applied twice, meaning that the ...
Qrrbrbirlbel's user avatar
1 vote

I cannot get Pgfplots to display all my axis labels

Thanks to @alchemist, here is the code that ended up displaying the labels that I needed on both axes: \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=newest} \usepackage{tikz} \...
ziadmbaroudi's user avatar
1 vote

How to add a legend to a Kiviat diagram with mutltiple lines? (tkz-kiviat)

You can use the MetaPost package mpkiviat (https://ctan.org/pkg/mpkiviat) that mimics tkz-kiviat. \documentclass{standalone} \usepackage{luamplib} \usepackage{fourier-otf} \begin{document} \begin{...
Maxime Chupin's user avatar
3 votes
Accepted

I cannot get Pgfplots to display all my axis labels

Seems to me the first and last ticks in both x and y axis are taken as the minimal resp maximal values of x / y when plotting the axes. So add the following lines to your code: xmin=153, xmax=197, ...
alchemist's user avatar
  • 1,856
1 vote
Accepted

groupplot: width and alignment

This uses three axis environment, using yshift and xshift to align them. Interestingly, putting a group plot into a savebox is not allowed (something about prevdepth). \documentclass[tikz, margin=5mm]...
John Kormylo's user avatar
  • 81.2k
2 votes

TikZ - multi-color double circle node

The great nfold library by Jonathan can make this very easy (and would work with other shapes as well – with a small caveat†). I'll provide two styles, one that doesn't change the outer sep (the ...
Qrrbrbirlbel's user avatar
3 votes
Accepted

inner xsep/ysep 0 not work as expected

You can see what is happening a bit more clearly if you use different colours to distinguish the inner and outer circle around B: \begin{tikzpicture} \node (A) [double circle={5pt}{red}, draw=blue,...
cfr's user avatar
  • 208k
1 vote

Combining `\addplot3` Commands with Separate Colors in PGFPlots

You have syntax errors in your colormap. There is a bug in PGFPlots when using z buffer=sort combined with a non-uniform colormap. \documentclass[tikz, border=1cm]{standalone} \usepackage{pgfplots} \...
hpekristiansen's user avatar
1 vote

Tikz: image act as transparency filter

I finally found the solution using fadings, notably the great tikzfadingfrompicture that is well documented and is basically exactly an equivalent of transparency masks. I needed also to invert the ...
tobiasBora's user avatar
  • 8,964
1 vote
Accepted

Non-label Marks at points in tikzpicture

If you want a label different from the node name : \tkzLabelPoint(Ref){Label} You can use the macro \foreach but it's not necessary \documentclass[tikz]{standalone} \usepackage{tkz-euclide} \begin{...
Alain Matthes's user avatar
1 vote

draw a circle shape with white inner circle by one command

One can use https://tex.stackexchange.com/a/36858/36296 : \documentclass[border=4mm] {standalone} \usepackage{tikz} \usetikzlibrary{calc} \begin{document} \tikzset{ old inner xsep/.estore in=\...
samcarter_is_at_topanswers.xyz's user avatar
1 vote
Accepted

how to draw this bar chart in latex?

Something to get you started; keys: absolute positions AND related to the nodes anchors you could switch to matrix placement for more flexibility place basic elements first introduce and modify ...
MS-SPO's user avatar
  • 13.8k
1 vote

Non-label Marks at points in tikzpicture

Adaptations added a \foreach loop with counter \xi over A to D draw nodes with fill=white at the vertices (If you want to place the nodes outside the polygon, you might need to define the position (...
dexteritas's user avatar
  • 9,361
2 votes

Cannot write \Cup in tikz-qtree binary tree structure in LateX

Here's a forest version which sets up a style my tree and makes it the default for all forest trees. (This could be shortened a bit by using the linguistics library.) I don't know whether you want \...
cfr's user avatar
  • 208k

Top 50 recent answers are included