# Tag Info

15

You can use the l3fp module of expl3: \documentclass{article} \usepackage{siunitx} % already loads xparse \ExplSyntaxOn \NewDocumentCommand{\temperature}{ O{0} m } { \bryebex_temperature:nn { #1 } { #2 } } \cs_new_protected:Npn \bryebex_temperature:nn #1 #2 { \SI{ \fp_to_decimal:n { round ( #2+273.15, #1 ) } } { \kelvin } \nobreakspace ( \SI { #2 ...

8

You can calculate the expression #1+273 outside \SI and use it. To calculate you can use your preferred method. I chose pgf. \documentclass{article} \usepackage{siunitx,pgf} \newcommand*{\temperature}[1]{\pgfmathtruncatemacro{\temp}{#1+273}\SI{\temp}{\kelvin} (\SI{#1}{\celsius})} %no truncation ...

8

The issue here is the mdwtab package, which completely alters the tabular code from array. Within siunitx, the code attempts to be cross-compatible by not making too many assumptions, but array is very widely used and so is treated as a baseline. To fix the issue, there are a couple of changes needed. First, you have to account for this altered table ...

7

In the meantime before an actual siunitx solution arrives here, you can use this expandable macro. But it will work only on (long) integers. For numbers in scientific notation you need something which extracts the mantissa, and then you can feed \indianum with this mantissa. \documentclass[12pt]{article} %\usepackage{siunitx} %\sisetup{group-separator = ...

5

Well, long time ago I was wondering the same thing, but in a more general form, i.e., I was wondering what would be the best way to insert units in LaTeX. Actually there are various packages, more than the two you are asking for. Back to your question and trying to solve it, I opted for siunitx. But since it is not possible to respond basing on my opinion ...

5

I've rearranged various parts of your code to make it look more like the images you've posted, since this is apparently how you would like the table to look. In particular, do note that if you want the standard errors associated with the coefficient estimates to show up below the coefficients, they need to be in their own separate row, not in the form 0.39 ...

5

Use the siunitx package. It is now the standard for typesetting units and numbers. Also keep in mind the the Scandinavian countries use the decimal comma as a decimal marker. \documentclass{article} \usepackage[output-decimal-marker={,}, group-separator={\,}, number-unit-product={\,}, ...

4

Assuming you want to stick with the dcolumn package, there are two important optimizations you could make which, jointly, would let you use a fontsize directive of \small rather than \scriptsize and still make the table fit into the available text block: Define your decimal column layout via \newcolumntype{Y}{D{.}{.}{1.2}} rather than the generic ...

4

adding \showoutput to your document you see ....\OT1/cmr/m/n/10 m ....\hbox(4.37393+1.94397)x5.5542 .....\TS1/cmr/m/n/10 � which means that siunitx is using TS1 ie the text companion font you would get from \usepackage{textcomp} which means basically you are out of luck as the TS1 encoding doesn't have a Greek alphabet, just ...

4

As said in the comment, the table-space-text-post option helps with saving the right space after the number. To stay with siunitx default setting, the thin space \, is used instead of a full space. The \sim macro is already one of the allowed input macros of siunitx and is used as a comparator. This allows you to use \sim without any protection in the ...

4

To each his/her favourite math engine... Update: using \xinttheexpr...\relax for infix notations. But it doesn't seem that \SI does a full expansion immediately, it first apparently parses for ( and ) among others. So I had to do a little trick with a \firstofone. \documentclass{article} \usepackage{siunitx,xintexpr} \providecommand\firstofone ...

2

My first thought: With luaLaTeX it should be quite easy. Here it is: \documentclass{scrartcl} \usepackage{siunitx} \newcommand{\temperature}[1]{\SI{\directlua{tex.sprint(#1+273.15)}}{\kelvin} (\SI{#1}{\celsius})} \begin{document} \temperature{100} \end{document} I replaced your #1+273 with \directlua{tex.sprint(#1+273.15)}.

2

You can use the \num macro on the cell contents as follows, by setting the code to assign the cells: \documentclass{article} \usepackage{filecontents} % For tables \usepackage{pgfplotstable} \usepackage{booktabs} \usepackage{array} \usepackage{etoolbox} \usepackage{units} \pgfplotsset{compat=1.9} \pgfplotstableset{ %font={\small}, empty cells ...

1

I used this script to rid my manuscript of all \gls and \glspl occurences, and replace them by acronyms using a very simple algorithm. Some editing was still needed afterwards. The script is quick and dirty. #!/usr/bin/env python3.2 f_in = "manuscript.tex" f_out = "manuscript_mod.tex" lines = open(f_in).readlines() acros = dict([(w[1][:-1], ...

Only top voted, non community-wiki answers of a minimum length are eligible