Hi all,
I am new to LaTeX, and was wondering if it's possible to create a value to be cross-referenced. For example, I would like to create a variable ("sample") that holds a number for the sample size (e.g., 70), and to be able to reference that value throughout the paper by calling the variable and not having to manually change the value in all places. Is this possible? Thanks so much!
General ⇒ Create a value to be cross-referenced
NEW: TikZ book now 40% off at Amazon.com for a short time.

Create a value to be cross-referenced
Well, it may depend on exactly how you want to use this "variable", but for most purposes, a custom command should do the trick:
Now, \sample will be replaced by "70" wherever it occurs. If you want to change it everywhere, you need to only edit the one line.
If you want something you can use as a length, etc., there may be better options, but we don't have quite enough information on what you plan on doing with this.
Code: Select all
\newcommand*{\sample}{70}
If you want something you can use as a length, etc., there may be better options, but we don't have quite enough information on what you plan on doing with this.