Tag Info

New answers tagged

0

You can use the pgf math engine as well: Notes: Besides the siunitx's \num macro you can also use \pgfmathprintnumber to control the formatting of numerical results. Code: \documentclass{article} \usepackage{pgfmath} \usepackage{siunitx} \newcommand{\calcnum}[1]{% \pgfmathparse{#1}% ...


1

Yes. Here's a LaTeX3 implementation: \documentclass{article} \usepackage{expl3, xparse, siunitx} \ExplSyntaxOn \NewDocumentCommand { \calcnum } { O{} m } { \num [ round-mode=places , round-precision=2 , group-separator={,}, group-minimum-digits=4, #1] { \fp_to_decimal:n {#2} } } \ExplSyntaxOff \begin{document} \calcnum{1000.97} ...


5

Here it is! With collcell we pass the cell's content to the \increment macro for being processed. \documentclass{article} \usepackage{xparse,collcell,booktabs} \ExplSyntaxOn \NewDocumentCommand{\increment}{m} { \pushpen_increment_cell:n { #1 } } \seq_new:N \l_pushpen_cell_seq \seq_new:N \l_pushpen_cell_incr_seq \cs_new_protected:Npn ...


3

You have a wrong \var in the definition of \addvar: \documentclass{article} \usepackage{fp} \newcommand{\defvar}[1]{% % var#1 := 0 \expandafter\FPset\csname var#1\endcsname{0}% } \newcommand{\addvar}[2]{% % var#1 += #2 \expandafter\FPadd\csname var#1\endcsname{\csname var#1\endcsname}{#2}% } % added for debugging ...


2

Using the datenumber package to do day arithmetic, and using my prior answer from the OP's cited question as the basis for my hr:mm arithmetic. The datenumber package allows the conversion of a date into a counter number (relative to a reference date). Syntax is: \timediff{year1}{month1}{day1}{h1:m1 am/pm}{year2}{month2}{day2}{h2:m2 am/pm} EDITED to ...


6

You could spend an hour or two writing this in TeX, or just use --shell-escape and \documentclass{article} \begin{document} \edef\pc{\csname @percentchar\endcsname} \def\foo#1#2{% time between #1 and #2 is \input{"|echo '(' ` date --date '#1' +\pc s` - `date --date '#2' +\pc s` ')/60' | bc"}% minutes} \foo{9am November 19 2014}{5pm November 15 2014} ...


1

You could do something like this but it is hard to tell, just from the information given, whether it would serve your purpose or not. \documentclass{article} \usepackage{pgfmath} \newcommand*\calc[1]{% \pgfmathparse{#1}\pgfmathresult} \begin{document} \def\myterm{1+2+4} $\myterm = \calc{\myterm}$ \end{document}


1

The tooltip text in the referenced answer is typeset into an LR-box and thus doesn't break across multiple lines. To do this, just put <tip text> into a \parbox of suitable, i. e. shorter than \linewidth, length.


3

Another solution, using the spreadtab package, and also siunitx, booktabs and makecell, to improve the look of the table. The spreadtab package allows to define computing formulae, among which I use \STcopy{v}{formula}, where the v argument makes the formula be translated for all cells of the same column. Another feature is I defined a rowno counter, so the ...


11

Here's a solution with collcell and xparse (for \fp_eval:n) \documentclass{article} \usepackage{collcell,booktabs,siunitx} \usepackage{xparse} \newcolumntype{F}{>{\collectcell\rememberF}c<{\endcollectcell}} \newcolumntype{M}{>{\collectcell\rememberM}c<{\endcollectcell}} \newcolumntype{P}{>{\collectcell\computeP}r<{\endcollectcell}} ...


5

If you do \savebox{\tmpboxa}{\rule{\textwidth}{50mm}}% This is where the image will be includegraphicsed \setbox0\hbox{\LENGTHDIVIDE{\wd\tmpboxa}{1mm}{\breite}% \ROUND[2]{\breite}{\Breite}% \LENGTHDIVIDE{\ht\tmpboxa}{1mm}{\hoehe}% \ROUND[2]{\hoehe}{\Hoehe}}\showoutput\showbox0 you'll see > \box0= \hbox(0.0+0.0)x6.66666 .\glue 3.33333 ...



Top 50 recent answers are included