What would be the procedure to see the value of a latex variable such as \baselinestretch and \parskip.
Macros, such as \baselinestretch): \show\baselinestretch and for a dimension such as \parskip): \showthe\parskip have been suggested to me.
Are the above commands that would be displayed in the latex document ?
It depends on the kind of variable and on where you wish to see the value of the variable:
Commands are to occur in the .tex-input-file/in the file containing the .tex source for your document.
As \show is mentioned while \show does actually not refer to the value of a "variable" but does refer to the meaning of a token, let's point out that the meaning of a token is not the same as the value of a "variable".
The term meaning of a token refers to information about the kind of which the token in question is, plus additional information depending on the kind of token.
I.e., whether the token in question denotes a macro or a register or a primitive or a character or ... .
In case of the token being a macro you also get information about predicates like \long, \outer, \protected and about parameter text and replacement text.
The command \show⟨token⟩ causes TeX to write information about the meaning of the token in question to the console and to the .log-file.
The command \meaning⟨token⟩ causes TeX to append character tokens of category 12(other), except spaces which are of category 10(space), to the token stream so that the sequence of these character tokens denotes the information about the meaning of the token in question. Further processing of these character tokens may lead to typesetting information about the meaning of the token in question to the output-file/.pdf-file which TeX is about to produce.
The term "variable" was officially introduced into TeX-jargon by the developers of LaTeX3/expl3.
Outside LaTeX3/expl3 the concept "variable" is rather vague in TeX/LaTeX.
Outside LaTeX3/expl3 "value of variable" may denote, e.g.,
- the value stored in a register,
- the value of a TeX-parameter,
- the replacement text of a parameterless macro in case that macro serves as "variable" and thus is defined so that the tokens forming its replacement text can be considered the value of the variable,
- the value of a LaTeX-counter defined via
\newcounter.
If "variable" is about a register or a TeX-parameter or the like :
The command \showthe⟨token⟩ causes TeX to write information about the meaning of the value of the register/TeX-parameter denoted by ⟨token⟩ to the console and to the .log-file.
The command \the⟨token⟩ causes TeX to append character tokens of category 12(other), except spaces which are of category 10(space), to the token stream so that the sequence of these character tokens denotes the information about the value of the register/TeX-parameter denoted by ⟨token⟩. Further processing of these character tokens may lead to typesetting information about the value of the register/TeX-parameter in question to the output-file/.pdf-file which TeX is about to produce.
If "variable" is about a parameterless macro whose expansion is considered to be the value of the variable:
The command \message{⟨token⟩} causes TeX to write the "value" of the "variable" denoted by the macro ⟨token⟩ to the console and to the .log-file.
The ⟨token⟩ itself, i.e., the command ⟨token⟩, causes TeX to append to the token stream the tokens that form the replacement text of the macro/variable denoted by ⟨token⟩.
As that replacement text is considered to be the value of the "variable" denoted by the macro token ⟨token⟩, further processing of the tokens forming that replacement text may lead to typesetting information about the value of the "variable" in question to the output-file/.pdf-file which TeX is about to produce.
In order to prevent further expansion of the tokens forming the replacement text of ⟨token⟩, you can do s.th. like
\detokenize\expandafter{⟨token⟩} .
If "variable" is about a LaTeX-counter defined via \newcounter, then, e.g., \number\value{⟨counter⟩} and \the\numexpr\value{⟨counter⟩}\relax can be used for obtaining a set of character tokens of category 12(other) denoting the value of that counter.
For writing to console and .log-file you can wrap that between \message{ and }.
\showthe\parskipand it will show the value in the log file. – David Carlisle Aug 11 '23 at 23:19