20

TikZ version 3.1 is available on CTAN since January 5, 2019.

Christian Feuersaenger published the latest version on sourceforge on the same day.

The manual of version 3.0.1a which had 1161 pages now has 1282 pages.

What's new in this version?

18
  • 6
    Do not get me wrong, but I am not sure this question is suitable for the website... The answer is simply a link to either an announcement or release notes... Jan 7 '19 at 18:02
  • 3
    @PauloCereda are you sure the correct answer isn't "121 pages" ? Jan 7 '19 at 18:24
  • 6
    Read the changelog: mirrors.ctan.org/graphics/pgf/base/doc/ChangeLog . I'm voting to close this question as off-topic because it's asking for off-site resources. Jan 7 '19 at 20:08
  • 3
    @HenriMenke The same question is not closed on version 3.0 What are the new features in TikZ/pgf 3.0?
    – AndréC
    Jan 7 '19 at 20:16
  • 6
    @AndréC Good point. I'll vote to close that one as well. Jan 7 '19 at 20:16
17

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.

14

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)

3
  • 5
    Hopefully, this will generate a lot of SVG and animation-related questions :-)) !
    – AlexG
    Jan 7 '19 at 19:23
  • 5
    @AlexG Hopefully these SVG and animated-related questions will generate lot of your interesting answers -- I'm looking forward to reading them :) Jan 7 '19 at 19:57
  • I must immediatly update!
    – vi pa
    Jan 8 '19 at 12:33
2

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:


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}

Not the answer you're looking for? Browse other questions tagged or ask your own question.