What's new in the latest version 3.1 of TikZ?

I make this answer a Wiki in order to allow those who are aware of the new features of version 3.1 to make them public.

  • A new pic type right angle

is added. (page 561)

Pic type right angle=<A>--<B>--<C>.

This pic adds a drawing of a right angle to the current path. It works in the same way as angle pic.

pic-right-angle

\tikz
  \draw (1,0,0) coordinate (A) -- (0,0,0) coordinate (B) -- (0,0,1) coordinate (C)
    (B) -- (0,1,0) coordinate (D)
    pic [fill=gray,angle radius=4mm] {right angle = A--B--C}
    pic [draw,red,thick,angle eccentricity=.5,pic text=$\cdot$]
    {right angle = A--B--D};
  • Unfortunately "The Data Visualization Backend"

which was not documented in version 3.0.1a is still not documented. (page 944)

  • The 3d library

that was available is now documented (page 557).

  • In grid

if the xstep or ystep is 0 or negative the corresponding lines are not drawn (p.157 of the documentation).

enter image description here

\begin{tikzpicture}
  \draw (0,0) grid [xstep=.5,ystep=.75] (3,2);
  \draw[thick,red] (0,0) grid [ystep=0] (3,2);
\end{tikzpicture}
  • SVG Animations;

compile with latex and dvisvgm --font-format=woff --exact --zoom=-1

\documentclass[dvisvgm]{standalone}
\usepackage{tikz}
\usetikzlibrary{animations}

\begin{document}

\tikz
\node :fill opacity = { 0s="1", 2s="0", begin on=click }
      :rotate = { 0s="0", 2s="90", begin on=click }
      [fill = blue!20, draw = blue, ultra thick, circle]
      {Click me!};

\end{document}

Static SVG and animated SVG without user interaction (e. g. activation on click) are embedded into HTML with the <img> tag, e. g.:

<img src="https://url/of/some.svg" width="200"/>

The <img> tag also works on this site (TeX.SX). Unfortunately, Imgur does not allow SVG file upload, but file URLs to third-party sites can be used.

Animated SVG with user interaction and scripted SVG (as those produced with pkg animate) must be embedded into HTML using the <object> tag:

<object type="image/svg+xml" data="https://url/of/some.svg" width="200">
  <!-- optional (increases loading time): fallback & search engine indexing -->
  <img src="https://url/of/some.svg" />
</object>

Unfortunately, Blog sites and StackExchange do not accept the <object> tag, mainly for security reasons. As a workaround, an <img> tag can be used as text of a link that redirects the browser to the file URL of the SVG on click. This was done for the example above. In Markdown syntax:

[<img src="https://url/of/some.svg" width="200"/>](https://url/of/some.svg)
  • Some basic tools for perspective drawing

with one, two, or three vanishing points have been added in the perspective library. Documentation is on page 726 (section 63) of the manual.

One of the examples from the manual can be drawn with:

\documentclass[tikz,margin=2mm]{standalone}

\usetikzlibrary{perspective}

\begin{document}
  \begin{tikzpicture}[
    isometric view,
    perspective={
      p = {(12,0,0)},
      q = {(0,12,0)},
      r = {(0,0,-12)}}]
      
    \fill[gray!80!white] (tpp cs:x=0,y=0,z=3)
      -- (tpp cs:x=0,y=3,z=3)
      -- (tpp cs:x=3,y=3,z=3)
      -- (tpp cs:x=3,y=0,z=3) -- cycle;
    \fill[gray] (tpp cs:x=0,y=0,z=0)
      -- (tpp cs:x=0,y=0,z=3)
      -- (tpp cs:x=0,y=3,z=3)
      -- (tpp cs:x=0,y=3,z=0) -- cycle;
    \fill[gray!50!white] (tpp cs:x=0,y=0,z=0)
      -- (tpp cs:x=0,y=0,z=3)
      -- (tpp cs:x=3,y=0,z=3)
      -- (tpp cs:x=3,y=0,z=0) -- cycle;
  \end{tikzpicture}
\end{document}

Results in:

enter image description here

A lot of standard Tikz keys are not (yet) supported, e.g. shift, xshift, yshift, rotate around x, rotate around y, rotate around z, all the canvas is ... plane keys from the 3d library, and there are bound to be more.


Well according to the Announcement text it's

Re­lease 3.1 in­tro­duces the new an­i­ma­tions li­brary for HTML/SVG out­put and comes with tons of bug­fixes.

There's also the full changelog. (I borrowed this link from Henri Menke's comment)


Patterns

  • In 3.1.4, a new library patterns.meta is documented. It provides mechanisms to define new patterns. Macros \pgfdeclarepattern and \tikzdeclarepattern are documented, as well as their options, accompanied by usage examples.
  • In 3.1.5, four new general and configurable patterns are added to library patterns.meta. They are Lines, Hatch (grids), Dots, and Stars and can be used as replacements for the ones provided by the patterns library. enter image description here

pgfmanual.pdf in recent versions

From release notes of pgf:

  • 3.1.5b, 3.1.5a, 3.1.5
  • 3.1.4b, 3.1.4a, 3.1.4
  • 3.1.3

The specific page and sectioning numbers per feature in pgfmanual changes from version to version, hence general descriptions are used.

  • To read the doc for specific library or option, users can search for key words (like patterns.meta) in Part References and Index of pgfmanual, then jump to its documentation by clicking corresponding index entry.
  • For common (option) names like scale, users will need to distinguish between multiple index entries.

Drawing codes behind the example image:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{patterns, patterns.meta}

\begin{document}
\foreach \i in {Lines, Hatch, Dots, Stars} {
  \tikz \path[pattern={\i}] (0, 0) rectangle node[above=1cm] {\i} (2, 2);
}

\begin{tikzpicture}
  \draw[pattern={Lines[angle=45]}] 
    (0, 0) rectangle node[above=1cm] {Lines} +(2, 2);

  \draw[pattern={Hatch[distance=5pt]}, pattern color=orange] 
    (2.2, 0) rectangle node[above=1cm] {Hatch} +(2, 2);

  \draw[pattern={Dots[radius=.5pt, angle=60]}] 
    (4.4, 0) rectangle node[above=1cm] {Dots} +(2, 2);

  \draw[pattern={Stars[points=5, distance=.5cm, xshift=-.15cm, angle=36]}, pattern color=blue] 
    (6.6, 0) rectangle node[above=1cm] {Stars} +(2, 2);
\end{tikzpicture}
\end{document}

Tags:

Tikz Pgf