I have a table that represents a timetable for bus, so each cell contains time of departure as hour followed by minute, both as two digits, but sometimes I don't have two digits,just one so I have to switch eg. from 12 4 -> 12 04.
How is it possible?
How to Convert One Digit Number to Two Digits
conversionnumberingstrings
Best Answer
You can define a macro as follows:
This macro is fully expandable.
If you also want to cut trailing zeros you can use:
If you want to change a
tabular
cell from12 4
to12 04
without adding explicit macros you can use thecollcell
package to collect the cell content and feed it to a macro which splits the numbers by the space:If you post a real usage example I can help me with more specific macros.