# Diagrams have a “sans-serif” look-and-feel

I am currently typing up some diagrams. (Dynkin diagrams to be precise.) My main text is in a serif font (plain old Computer Modern). The diagrams are currently made in TikZ, and they give me an certain sans-serif feeling that I find hard to make precise. See below for an MWE.

Q. (soft) Do you recognise the sans-serif feeling?

Q. Do you have any suggestions how to make the diagrams look more “serif”?

Drawing the diagrams in TikZ is not a requirement. I am fine with solutions that use Metafont, Postscript, or similar “low-level” tools.

After some comments, I think it might be helpful if I give an idea/direction of what I'm looking for. I quote from the comment section: “I guess one could draw the circles with a tapered pen, just like a serif ‘o’. So that the top and bottom are narrow, and the left and right are wide. For the lines, one could also imagine that they have varying width, or tapered ends. This might be visible if the lines don't exactly touch the nodes...”

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[full]{textcomp}

\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{cd,positioning,shapes}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{decorations.markings}

\begin{document}
Let $\Delta$ be a connected Dynkin diagram, and
let $\Delta^+$ be the extended (or affine)
Dynkin diagram associated with~$\Delta$.
Then $\Delta^+ = \Delta \sqcup \{\alpha_0\}$.
Below we depict the connected extended Dynkin diagrams,
in which $\alpha_0$ is depicted by a grey node
\tikz \node[draw,circle,inner sep=2pt,fill=gray] {};.
$\begin{tikzpicture}[ yscale=-1.3, every node/.style={draw,circle,inner sep=2pt}, every label/.append style={rectangle,font=\footnotesize, inner sep=1ex,text depth=1pt}, decoration={markings}, doubledynkin/.style={double distance=2pt,postaction=decorate}, a0/.style={fill=gray} ] \node[draw=none] (A1text) [label=right:{\normalsizeA_1^+:}] at (-.5,0) {}; \node[a0] (A10) at (1,0) {}; \node (A11) at (2,0) {}; \draw[double distance=2pt, decoration={ mark=at position 0.95 with {\arrow{>}}, mark=at position 0.36 with {\arrow{<}} }, postaction=decorate] (A10) -- (A11); \begin{scope}[xshift=5cm] \node[draw=none] (Antext) [label=right:{\normalsizeA_n^+ (n \ge 2):}] at (-1.5,0) {}; \node[a0] (An0) at (3,-0.7) {}; \node (An1) at (1,0) {}; \node (An2) at (2,0) {}; \node (Annm1) at (4,0) {}; \node (Ann) at (5,0) {}; \draw (Annm1) -- (Ann) -- (An0) -- (An1) -- (An2); \draw[dashed] (An2) -- (Annm1); \end{scope} \end{tikzpicture}$
\end{document}


• How can a diagram look “sans serif”? In my opinion they look just fine. – Henri Menke Mar 23 '18 at 8:41
• The text in your diagrams are in cm math italic which is a font with serifs, you can't have serifs on lines and circles so it is hard to guess what possible answer you could have here. – David Carlisle Mar 23 '18 at 8:49
• I'm not an expert in Metafont, but I guess one could draw the circles with a tapered pen, just like a serif ‘o’. So that the top and bottom are narrow, and the left and right are wide. For the lines, one could also imagine that they have varying width, or tapered ends. This might be visible if the lines don't exactly touch the nodes... These are my random thoughts, but I'm not an expert, and I'm looking for suggestions. – jmc Mar 23 '18 at 8:53
• Such requirements, especially for the lines, will hit the limits of the Postscript and PDF specifications for lines. Lines with varying widths could be approximated somehow, as quadrangles with bezier curves as edges, perhaps. – AlexG Mar 23 '18 at 8:59
• ...or using some font to make the circles (○, U+25CB) that has the appropriate "feel". – Rmano Mar 23 '18 at 9:03

I certainly do not precisely know how serif works, but if I look at the appearance of a \Delta then it seems that some line widths are larger than others. Analogously, the contours of Dynkin nodes might want to become a bit thicker towards the south east. The perhaps simplest way to achieve this in the given settings is to add a tiny black pseudo-shadow to each of them.

EDIT: Proposal after feedback.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[full]{textcomp}

\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{cd,positioning,shapes}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{backgrounds}
\begin{document}
Let $\Delta$ be a connected Dynkin diagram, and
let $\Delta^+$ be the extended (or affine)
Dynkin diagram associated with~$\Delta$.
Then $\Delta^+ = \Delta \sqcup \{\alpha_0\}$.
Below we depict the connected extended Dynkin diagrams,
in which $\alpha_0$ is depicted by a grey node
\tikz \node[draw,circle,inner sep=2pt,fill=gray] {};.
$\begin{tikzpicture}[ Dynkin/.style={yscale=1.2,draw,circle,fill=white,minimum width=8pt,inner sep=0pt, append after command={\pgfextra{\begin{pgfonlayer}{background} \draw[yscale=1.2,fill=black] ([xshift=0.18pt,yshift=-0.15pt]\tikzlastnode) circle (4.2pt); \end{pgfonlayer} }}}, every label/.append style={rectangle,font=\footnotesize, inner sep=1ex,text depth=1pt}, decoration={markings}, doubledynkin/.style={double distance=2pt,postaction=decorate}, a0/.style={fill=gray}, every shadow/.style={fill=black,opacity=1,shadow xshift=0.5pt, shadow yshift=-0.2pt}, Dynkin line/.style={preaction={transform canvas={shift={(0.2pt,-0.2pt)}},draw, #1}}, ] \node[draw=none] (A1text) [label=right:{\normalsizeA_1^+:}] at (-.5,0) {}; \node[Dynkin,a0] (A10) at (1,0) {}; \node[Dynkin] (A11) at (2,0) {}; \draw[double distance=2pt, decoration={ mark=at position 0.95 with {\arrow{>}}, mark=at position 0.36 with {\arrow{<}} }, postaction=decorate] (A10) -- (A11); \begin{scope}[xshift=5cm] \node[draw=none] (Antext) [label=right:{\normalsizeA_n^+ (n \ge 2):}] at (-1.5,0) {}; \node[Dynkin,a0] (An0) at (3,1) {}; \node[Dynkin] (An1) at (1,0) {}; \node[Dynkin] (An2) at (2,0) {}; \node[Dynkin] (Annm1) at (4,0) {}; \node[Dynkin] (Ann) at (5,0) {}; \begin{scope}[on background layer] \draw[Dynkin line] (Annm1.center) -- (Ann.center) -- (An0.center) -- (An1.center) -- (An2.center); \draw[Dynkin line=dashed,dashed] (An2.center) -- (Annm1.center); \end{scope} \end{scope} \end{tikzpicture}$
\end{document}


• I am beginning to like the question. And even more your answer :-) – AlexG Mar 23 '18 at 15:35
• Yes, this is a very nice suggestion. Exactly the kind of suggestion I am looking for! – jmc Mar 24 '18 at 12:29
• @marmot Is it possible to also have drop shadows on the edges? So that some lines will actually be thicker than others? Of course all the drop shadows should be in the same direction... – jmc Mar 24 '18 at 13:14
• @jmc Sure. Which of the two proposals do you prefer? – user121799 Mar 24 '18 at 14:10
• @marmot aah, this is what you are doing in the second example! Cool! I think I would combine both proposals. (In the first proposal you also have scale the nodes, so that they are elliptical.) – jmc Mar 24 '18 at 15:37

i also do not understand what is meant by the "more serif" experience. used font is "serif" ... for nodes i suspect, that you like to have ellipses (obtained by scaling, which influence also on font size) instead of circles:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[full]{textcomp}

\usepackage{tikz}
\usetikzlibrary{arrows.meta,
decorations.markings,
positioning,
shapes.geometric}

\begin{document}
Let $\Delta$ be a connected Dynkin diagram, and let $\Delta^+$ be the extended (or affine) Dynkin diagram associated with~$\Delta$. Then $\Delta^+ = \Delta \sqcup \{\alpha_0\}$. Below we depict the connected extended Dynkin diagrams, in which $\alpha_0$ is depicted by a grey node \tikz\node[ellipse,draw,semithick,fill=gray,inner xsep=2pt,inner ysep=3pt] {};.
$\begin{tikzpicture}[ node distance = 10mm and 10mm, every node/.style = {ellipse, draw, semithick, inner xsep=3pt, inner ysep=4pt}, every label/.append style = {label distance=1em, rectangle, draw=none}, a0/.style = {fill=gray}, doubledynkin/.style={double distance=2pt, decoration={markings, mark=at position 0.9 with {\arrow[semithick]{Straight Barb[length=5pt]}}, mark=at position 0.1 with {\arrowreversed[semithick]{Straight Barb[length=5pt]}} }, postaction={decorate}, } ] \node[label=left:{A_1^+:}] (A10) {}; \node[right=of A10] (A11) {}; \draw[doubledynkin] (A10) -- (A11); % \begin{scope}[xshift=5cm] \node[label=left:{A_n^+ (n\ge 2):}] (A1) {}; \node[right=of A1] (A2) {}; \node[a0,above right=of A2] (A3) {}; \node[below right=of A3] (A4) {}; \node[right=of A4] (A5) {}; % \draw (A2) -- (A1) -- (A3) -- (A5) -- (A4); \draw[dashed] (A2) -- (A4); \end{scope} \end{tikzpicture}$
\end{document}


in above code i use positioning library for relative placement of nodes. with this you can with change of node distance simply change all distance between nodes. beside this, i simplify image code with removing all unnecessary nodes.

addendum for fun and exercise :-)

added fancy stuff as copy shadow, one emphasized (thicker) line between the most left and top node in "triangle" nodes formation, by moving styles definition in document preamble, overall code is slightly shorter ...

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[full]{textcomp}

\usepackage{tikz}
\usetikzlibrary{arrows.meta,
decorations.markings,
positioning,
shapes.geometric}
\tikzset{Dynkin/.style =
{
every node/.style = {ellipse, draw, semithick, inner xsep=3pt, inner ysep=4pt,
fill=white,
},
every label/.append style = {label distance=1ex, rectangle, draw=none,
},
a0/.style = {fill=gray!50},
doubledynkin/.style={double distance=2pt,
decoration={markings,
mark=at position 0.9 with {\arrow[semithick]{Straight Barb[length=5pt]}},
mark=at position 0.1 with {\arrowreversed[semithick]{Straight Barb[length=5pt]}}
},
postaction={decorate},
}
}% end of Dynkin style
}% end of tikzset

\begin{document}
Let $\Delta$ be a connected Dynkin diagram, and let $\Delta^+$ be the extended (or affine) Dynkin diagram associated with~$\Delta$. Then $\Delta^+ = \Delta \sqcup \{\alpha_0\}$. Below we depict the connected extended Dynkin diagrams, in which $\alpha_0$ is depicted by a grey node \tikz[Dynkin]\node[a0,scale=0.75] {};.
$\begin{tikzpicture}[Dynkin, node distance = 12mm and 12mm, ] \node[label=left:{A_1^+:}] (A10) {}; \node[right=of A10] (A11) {}; \draw[doubledynkin] (A10) -- (A11); % \begin{scope}[xshift=48mm] \node[label=left:{A_n^+ (n\ge 2):}] (A1) {}; \node[right=of A1] (A2) {}; \node[a0,above right=of A2] (A3) {}; \node[below right=of A3] (A4) {}; \node[right=of A4] (A5) {}; % \draw[semithick] (A1) -- (A2) (A4) -- (A5) -- (A3); \draw[very thick] (A1) -- (A3); \draw[semithick, dashed] (A2) -- (A4); \end{scope} \end{tikzpicture}$
\end{document}


• Thanks for your answer. This is already an improvement. When combined with the other answer on shadows, I think it is very nice. – jmc Mar 24 '18 at 12:29
• @jmc, now i add (for my fun and exercise) some fancy stuff and make code slightly shorter. used styles are now available to any similar picture. – Zarko Mar 24 '18 at 17:11
• Very nice edit! Thanks a lot... Alas, I can only accept one answer... – jmc Mar 24 '18 at 17:13
• @jmc, i know, i know :-) . but it may happen that once in a while you will see the (small) advantages of my answer over accepted ones ;-). however, accepted is not bad at all. – Zarko Mar 24 '18 at 17:23

I guess it needs more cowbell.

\documentclass{article}
\usepackage{tikz}
\tikzset{cowbell/.style={
path picture={\draw[line width=\the\pgflinewidth+1pt]
(path picture bounding box.north east) |- (path picture bounding box.south west);},
draw,minimum size=3mm, inner sep=0
}
}

\begin{document}
Let $\Delta$ be a connected Dynkin diagram, and let $\Delta^+$ be the extended (or affine)
Dynkin diagram associated with~$\Delta$. Then $\Delta^+ = \Delta \sqcup \{\alpha_0\}$.
Below we depict the connected extended Dynkin diagrams, in which $\alpha_0$ is depicted by a
grey node \tikz \node[cowbell, fill=gray] {};.

\begin{tikzpicture}
\node[draw=none] (A1text) at (-.5,0) {$\displaystyle A_1^+ (n\geq2)$:};
\begin{scope}[shift={(A1text.east)}]
\foreach\x in {1,2,4,5}{\node[cowbell] (n-\x) at (\x,0) {};}
\node[cowbell, fill=gray] at (3,1) (n-3) {};
\draw (n-4) --(n-5) -- (n-3) -- (n-1) -- (n-2);
\draw[dashed] (n-2) -- (n-4);
\end{scope}
\end{tikzpicture}
\end{document}


I understand the temptation but serif doesn't mean rigor. That's an occupational hazard.

• Thanks for this answer! The only reason I am looking for a “serif” look-and-feel is because I want the style of the diagrams to match the overall style of the text. The current answers are a nice step in that direction. – jmc Mar 24 '18 at 12:28
• @jmc As I said there is no serif feeling. It's just that you are using too many math symbols with calligraphy and blackboard fonts :) – percusse Mar 24 '18 at 13:41
• I am sorry, but I really don't understand your comment. In the example that I provided there are no calligraphy or blackboard fonts. Or are you giving a critique of mathematical writing in general? – jmc Mar 24 '18 at 13:44
• @jmc The deltas, CM font and the math font is giving you the sensation that the circles are sans serif-like. Actually there is nothing wrong with them, they look pretty OK but you feel like they don't have enough pressure on the type. That's why I've replaced them with \Delta-like squares – percusse Mar 24 '18 at 13:48
• I agree with you, in the sense that in general there is not much wrong with the diagrams; I am pretty satisfied with them. But given their context (deltas, CM font and the math font) I think my sensation isn't too wrong, and it is justified to try and put a bit more “pressure on the type” in the diagrams. And now that you explain your choice of the squares as being inspired by the \Delta's I like this answer even more. – jmc Mar 24 '18 at 13:53

The dynkin-diagrams package on CTAN has a style ceref (an antiquated spelling of serif, intended to avoid confusion with the style of the fonts in the Dynkin diagram labels), based on marmot's solution.

\documentclass{article}
\usepackage[ceref,mark=o,affine-mark=*]{dynkin-diagrams}
\begin{document}
Let $\Delta$ be a connected Dynkin diagram, and let $\Delta^+$ be the extended
(or affine) Dynkin diagram associated with~$\Delta$. Then $\Delta^+ = \Delta \sqcup \{\alpha_0\}$. Below we depict the connected extended Dynkin diagrams,
in which $\alpha_0$ is depicted by a grey node \dynkin{A}{*}.
$A_1^+: \dynkin{A}[1]{1} \qquad A_{n\ge 2}^+: \dynkin{A}[1]{}$
\end{document}