Text FormattingtikZ | Bad Math Spacing with circled Number

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

tikZ | Bad Math Spacing with circled Number

Post by ghostanime2001 »

How can I have the 1 symbol behave like an expression like surrounded with $ $ ?
(btw I have already tried surrounding the tikz code in the preamble with $ $ and the spacing remains unchanged)

Code: Select all

{$#1$};}}
If I type \left(-1\right)\times\left(-1\right) in one line the spacing is correct as shown in the first picture below but when I use \left(-1\right)\times\ci{1} together with the ding symbol and type in one row I get different spacing as shown in the second picture.

Also I am trying to stay away from manually changing horizontal lengths because that would mean changing this for every equation I am going to type up.

This is my MWE for one of the type of formatting:

Code: Select all

\documentclass{article}
\usepackage[version=3]{mhchem}
\usepackage{tikz}

\newcommand{\ci}[1]{\tikz[baseline=(char.base)]{\node[shape=circle,draw,inner sep=1pt] (char) {$#1$};}}

\begin{document}
  $\begin{array}[t]{@{}l@{}}
  \left(-1\right)\times\ci{1}
  \end{array}$
\end{document}
Attachments
pic 2.png
pic 2.png (20.17 KiB) Viewed 1558 times
pic 1.png
pic 1.png (12.83 KiB) Viewed 1558 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Post Reply