0

This query is based on this.

buffHeight and vertDis’s dimensions are in pt. What about macro-defined constants (\buffHeight and \vertDis)? Are they unitless? If so, if I slap in a unit, i.e., \buffHeight cm, would it give me 5 cm, and \buffHeight in 5 inches?

Superman
  • 1,615
  • Macros expand to their definition as they are encountered by the expansion processor, i.e. \buffHeight cm will become a literal 1cm. – Henri Menke Mar 11 '21 at 17:20
  • And likewise, if I put in instead of cm, the macro’s dimensions will be in inches instead of centimeters. – Superman Mar 11 '21 at 17:21
  • Yes, there are also a couple of other units you can use. There is a list here: https://tex.stackexchange.com/questions/8260/ – Henri Menke Mar 11 '21 at 17:23
  • Oh ok. By the way, if I don’t specify the units for the macro, are the macro’s units set to pt by default? I.e. just saying minimum height = \buffHeight would give \buffHeight pt – Superman Mar 11 '21 at 17:24
  • No, a macro doesn't have units. It just expands to its literal value. What you are referring to is \pgfsetlength which is an entirely different story because it implements its own parser. In this context dimensionless numbers are implicitly assigned pt but that is very different from TeX's normal dimension parsing. For example \parindent=1 would raise an error whereas \pgfmathsetlength{\parindent}{1} would assign 1pt. – Henri Menke Mar 11 '21 at 17:28
  • Oh, so would the line minimum height = \buffHeight when setting up the shape’s dimensions raise an error? – Superman Mar 11 '21 at 17:35
  • No, because that is parsed with \pgfmathsetlength (like most things in TikZ), so \buffHeight expands to a literal 1 which receives an implicit pt. – Henri Menke Mar 11 '21 at 18:11
  • Oh, it’s done in the backend for the aforementioned case. Interesting. – Superman Mar 11 '21 at 18:11

0 Answers0