-
Notifications
You must be signed in to change notification settings - Fork 2
Autofilling Values
To facilitate reproducibility, figures and tables should always be generated programmatically and never include hard-coded values. The tablefill
package of gslab_make
is a useful tool to help create complex tables.
Frequently, it is necessary to include values derived from calculations in the text of a document. For example, we may wish to reference a coefficient from a regression specification. To facilitate reproducibility and avoid text from becoming outdated, it is recommended to include values programatically. Below, we detail methods for doing so.
- Go to
Document
,Settings
, and thenLaTeX Preamble
. Paste in the following. Here,scalars
refers to ascalars.tex
file located in the same directory as the LyX document. You may renamescalars
according to your preferences. For example,\input{../more_scalars}
would refer to amore_scalars.tex
file located in the parent directory of the LyX document.
\input{scalars}
- Using a program of your choice (e.g., Stata), generate file
scalars.tex
with the following. Here,value
refers to the value you wish to include in the document. You may renamescalarmath
andscalartext
according to your preferences. Note that LaTeX places restrictions on how new commands may be named.
\newcommand{\scalarmath}{value}
\newcommand{\scalartext}{\textnormal{value}}
- Use the macro
\scalarmath
to display the value in math mode. Use the macro\scalartext
to display the value in text mode.
- In the document preamble, paste in the following. Here,
scalars
refers to ascalars.tex
file located in the same directory as the LyX document. You may renamescalars
according to your preferences. For example,\input{../more_scalars}
would refer to amore_scalars.tex
file located in the parent directory of the LyX document.
\input{scalars}
- Using a program of your choice (e.g., Stata), generate file
scalars.tex
with the following. Here,value
refers to the value you wish to include in the document. You may renamescalarmath
andscalartext
according to your preferences. Note that LaTeX places restrictions on how new commands may be named.
\newcommand{\scalarmath}{value}
\newcommand{\scalartext}{\textnormal{value}}
- Use the macro
\scalarmath
to display the value in math mode. Use the macro\scalartext
to display the value in text mode.
In cases where including a hard-coded value in-text is unavoidable, include a red LaTeX comment for fact-checking. Yellow LyX comments should be used for comments between coauthors to be resolved and deleted.
- Home
- Our organization
- Our core values
- Getting organized
- Working on Projects
- Contributing to the TSH website
- Notes for Deboarding