Reputation: 73
How to convert all numerical numbers appeared in the article (both in math mode and in text mode) in math mode globally in Latex? or How to globally set the font for numerical numbers in latex? N:B: I use overleaf. Thank you.
\documentclass[12pt,leqno]{article}
\usepackage{times} % set font Times New Roman
\usepackage[margin=1in]{geometry}
\usepackage{amsfonts}
\usepackage{amsmath,amsthm,amssymb}
\usepackage{multirow}
\usepackage{booktabs,threeparttable}
\usepackage{booktabs,siunitx}
\begin{document}
I want all the numerical numbers like 1, 2, 3, 4, -5, -8, 100, -58, 48 in math mode.
Like $1, 2, 3, 4, -5, -8, 100, -58, 48$.
\begin{table}[H]
\fontsize{10pt}{10pt}
\selectfont
\centering
\renewcommand*\TPTnoteLabel[1]{\parbox[b]{3em}{\hfill#1\,}}
\begin{threeparttable}
\caption{{Reduced form Estimates}}\label{tab:t4}
\begin{tabular}{l c c c c}
\hline
\toprule%\rowstyle{\bfseries}
&\multicolumn{4}{c}{{\textsc{Dependent Variable:}}} \\
\cmidrule{2-5}
\multicolumn{1}{l}{{\textsc{Independent Variable:}}} & \multicolumn{1}{c}{1} & \multicolumn{1}{c}{2} & \multicolumn{1}{c}{3} & \multicolumn{1}{c}{4}\\
\midrule
XXX & -0.2053***& 0.0815***& 0.0773***& $0.1090$***\\
& (0.0006) & (0.0007) & (0.0006) & (0.0008) \\
\hline
\(N\) & 752978 & 752978 & 752978 & 752978 \\
\end{tabular}
\footnotesize
\begin{tablenotes}
\item [{Notes}:] Heteroscedasticity robust standard errors in parentheses. Significance levels are indicated by \textsuperscript{***}$p<0.01$, \textsuperscript{**}$p<0.05$, \textsuperscript{*}$p<0.1$.
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document}
Upvotes: 0
Views: 429
Reputation: 38783
You are anyway loading the siunitx
package, so you should write your numbers as
I want all the numerical numbers like \num{1}, \num{2}, \num{3}, \num{4}, \num{-5}, \num{-8}, \num{100}, \num{-58}, \num{48} in math mode.
Like $\num{1}, \num{2}, \num{3}, \num{4}, \num{-5}, \num{-8}, \num{100}, \num{-58}, \num{48}$.
and siunitx
will take care of the rest, for example it will automatically choose the correct font and mode.
Unrelated to your problem, but don't load the same package more than once.
Upvotes: 0