I have a problem about calculator package, I need check if #1 is a number or not, could I use conditional command? ex:  \def\CHECK#1{  % if #1 a number  \if...?   #1 is a number  \else   #1 is not a number  \fi  }  \CHECK{3}  \CHECK{n}
120706
I want to do the following: I am generating a report which can be set to be in imperial or metric units. All values are originally in metric units, so in the case of imperial units all values should be converted. Some values can be say N/A or any other string value, in case the value is not applicable. The document is automatically generated. For conversion I am using the fp package, but the challenge is the checking the input. The fp package (and pgfmath) will ofcourse) err if you try to do math with non-numerical values. This is what I currently have (only works for integer input)  % Convert meters to inches \newcommand{\convertmtoin}[2] {     \if!\ifnum9&lt;1#1!\else_\fi        \FPeval{val}{#1*39.3700787} \FPround{\val}{\val}{#2}     \else     \def\val{#1}     \fi }   Using pgfmath one could do something like this  \newcommand{\convertmtoin}[2] {     \pgfmathfloatparsenumber{#1}     \pgfmathfloatifflags{\pgfmathresult}{3}{\FPeval{val}{#1*39.3700787} \FPround{\val}{\val}{#2}}{\def\val{#1}}  }   But I am not able to set the error handler of pgfmath to output NaN in the case of erronous input to pgfmathfloatparsenumber  \pgfkeys{/pgf/fpu/handlers/invalid number={??}{??}}   Thanks for any help!
3152
I have over 6000 records and half of them are formulas that are missing a variable so they result in #N/A on the spreadsheet, what i want to do is if the cell is #N/A then leave the cell blank, otherwise print a string like so  =IF(AR6347="#N/A","","string in here")   But this does not work with ="#N/A", is there a way to do this?
120737
How to use if-then-else structure in LaTeX? I need an example of odd and even page.  if odd then   command 1 else   command 2
54017
I am trying to define a command that takes two arguments, where one is optional. If the optional argument isn't given I would like the compulsory argument to be used for the optional argument.  For example:  \necommand{\foo}[2][#2]{#1 foo(#2)}   which would return:  IN: \foo[hello]{hi}      OUT: hello foo(hi) IN: \foo{hi}             OUT: hi foo(hi)   Ideally it would be nice to keep it simple and use standard LaTeX with no packages. Thanks in advance!
118876
I wanted to make a command that outputs a number in math mode. This is how my file looks like:  \documentclass{scrartcl}  %\usepackage{epsdice} %\newcommand{dice}[1]{\epsdice{#1}}  \newcommand{dice}[1]{\ensuremath{#1}}  \begin{document} Lorem ipsum... \end{document}   But when I compile this with XeTeX, I always get this error:  ! LaTeX Error: Missing \begin{document}.  See the LaTeX manual or LaTeX Companion for explanation. Type  H &lt;return&gt;  for immediate help.  ...                                                l.13 \newcommand{dice}[1]{\ensuremath{#1}}   I have not that much experience with TeX, I think the solution is quite easy.
66729
I want to compare two floating point numbers in a shell script. The following code is not working:  #!/bin/bash    min=12.45 val=10.35     if (( $val &lt; $min )) ; then       min=$val fi echo $min
97806
Why can't I start a numbered list on an arbitrary number?  Example:   Some Point   sub point sub point    some explaination pertaining to point 1 above   this should be a 2. not a 1. as I wrote 2. but it changes automatically to 1.   Escaping the dot moves the list too far to the left.  Can we get lists that start on any number?
105437
I have problems with my IF command in Google Sheets. If gives #ERROR! all the time. See this simple test:    Not even if I put in the number directly and avoid references:    Am I using the IF wrong? Or what could such a problem be? This example is from a new document.
5598
I'm hoping there's something in the same conceptual space as the old VB6 IsNumeric() function?
91891
I was looking for a command to limit numbers read in from stdin.  I wrote a little script for that purpose (critique is welcome), but I was wondering if there was not a standard command for this, simple and (I think) common use case.  My script which finds the minimum of two numbers:  #!/bin/bash # $1 limit  [ -z "$1" ] &amp;&amp; { echo "Needs a limit as first argument." &gt;&amp;2; exit 1; }  read number  if [ "$number" -gt "$1" ]; then         echo "$1" else         echo "$number" fi
28794
Possible Duplicate:          I wanted to know if it was possible to define a new command with a name that contains numbers?  e.g. \newcommand{\agent1}{agent~1}  Or even \ag1ent if having a number at the end is problematic.  I couldn't find the answer in the FAQ.
89242
I have made a command  \newcommand{\mysec}[2]{%  \textbf{#1} \\ #2 }   I use it with \mysec{A}{B}.  But sometimes I also want a third parameter. I could make a whole new command for those situations where I need 3 parameters. But I thought if I could handle it with an optional parameter in my original command?  So I have to check if the third parameter is set and how to print if it is set.
23695
I am using \if condition in a custom command in my LaTeX document. I would like to know where I can find some good explanation about \if command. I followed a  but it's just an example; there are not any explanation.
72634
I have this legacy code that I am working with and there is code like this all over the place:       #If PRE611 = True Then         'Do Something     #Else         'Something Else     #End If   I am pretty sure the PRE611 has something to do with versioning, but I would like to know what specifically the # sign does.
6653
Suppose I want to execute a sequence of four commands that I have executed before. If the first one is 432 in the command-history, then I could do:  $ !432; !433; !434; !435   I'm curious, is there a more efficient way to accomplish this?
74752
Is there a way to do underscripts? By "underscript" I mean a small font underneath the text object like limits or sums have. I don't want it to behave like a math operator though, where it is typeset as a subscript or underscript depending on the environment (like sums). I want there to always be an underscript in math environments with the possibility of adding a subscript in addition to the underscript. Is there anything like an \underscript{X}{a} command?  Is there even something like that that will only work in mathmode? I haven't been able to find it.
104222
I'm trying to have a small function that I then call.  To keep it simple I just want to validate that 12 is divisible by 2,3 and 4  The code is:  divisible_by () {   under_test=12   from=2   to=4   divisible=0   for ((check=from; check&lt;=to; check++)) {     echo "check= $check"     if [ $under_test % $check -ne 0 ]; then       divisible=1     fi     }   return $divisible }  x=divisible_by if [ $x -eq 0 ]; then   echo "true" else   echo "false" fi   Currently I get   ./5_divisible_by_1_to_10.sh: line 16: [:  divisible_by: integer expression expected false   I'm also finding it hard to pass the number in as a parameter but maybe it's related.