Загрузка...

Aligning Text in TikZ Nodes (Mini 6 from Ep 64 of Unlocking LaTeX Graphics)

In this mini-episode of Unlocking LaTeX Graphics, applied mathematician Tammy Kolda explains the TikZ base anchor and its base west and base east variants for aligning text labels across nodes. Starting from a setup with a cyan circle and an orange square, each capped with a text label placed using anchor=south and a small yshift, she shows that the labels look subtly misaligned because the descender on the q in Square pushes its label up. She draws a red baseline through the Circle label to make the misalignment obvious, then walks through two unsatisfying hacks: adding a vertical phantom q to the Circle label, and fiddling with yshift. Both are fragile when text changes. The robust fix uses anchor=base: she builds a target point with bar-dash syntax that horizontally aligns with the center of the square and vertically aligns with the baseline of the Ctext node, then anchors the Square text to that point. The result is text that lines up cleanly regardless of descenders, exponents, or other vertical quirks. This mini-episode is extracted from Episode 64, Six Hidden Tricks in TikZ.

00:00 Welcome & Today's Topic
00:15 Setup and Misalignment
01:00 Failed Workarounds
01:26 Using the Base Anchor
02:13 Thanks for Watching

Key terms: texlatex, tikz, base anchor, base west, base east, baseline alignment, node anchors, phantom, descender

Other Episodes

* Six Hidden Tricks in TikZ (Ep. 64 - full episode this mini is extracted from): https://youtu.be/-8gGZk5phU4
* TikZ Node Angle Anchors (Mini 1 from Ep. 64): https://youtu.be/Mntmfy0M2xk
* TikZ Corner Coordinates (Mini 4 from Ep. 64): https://youtu.be/L58Cnrx0eGw
* Node Shapes and Anchors (Ep. 15): https://youtu.be/Uk5ikND75YA

Today's Document on Overleaf: https://www.overleaf.com/read/qndqnfjchqwd#108f2a

Unlocking LaTeX Graphics Book: https://latex-graphics.com

Purchase Book on Amazon: https://amzn.to/3z76nwb

Видео Aligning Text in TikZ Nodes (Mini 6 from Ep 64 of Unlocking LaTeX Graphics) канала Unlocking LaTeX Graphics
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять