# Revision history [back]

### Spanish numbers using LaTeX

Dear SageMath community,

I am currently writing a LaTeX document in Spanish that relies heavily on sageTeX for computations. The rules for writing numbers in Spanish are a little different from English ones. For example, we are prohibited from using commas to separate every 1000 factor, instead using a small space only if the number is longer than four digits; on the other hand, the decimal point is actually a decimal comma. For example,

1,000,000.25 should be written as 1 000 000,25

123,456,789.123456789 should be written as 123 456 789,123 456 789

4,000 should be written as 4000

Using sageTeX and SageMath's latex command, and LaTeX babel package, it is easy to replace the decimal point with a decimal comma. It is also easy to eliminate the commas for every 1000 factor. However, I haven't been able to put a small space instead.

I could use the siunitx LaTeX package, which has a command, \num, that does exactly this processing. However, it doesn't work with sageTeX's \sage command or any of it's environments. The only solution I can find is to apply the \num command directly to every number generated by SageMath via the latex command.

My problem is: I don't know how to do this, specially in cases where numbers are entries of a matrix, or the coefficients of a polynomial. So, how could I apply the \num command to every number independently using the latex command?

### Spanish numbers using LaTeX

Dear SageMath community,

I am currently writing a LaTeX document in Spanish that relies heavily on sageTeX for computations. The rules for writing numbers in Spanish are a little different from English ones. For example, we are prohibited from using commas to separate every 1000 factor, instead using a small space space, only if the number is longer than four digits; on otherwise, no sign should be used. On the other hand, the decimal point is actually a decimal comma. For example,

• 1,000,000.25 should be written as 1 000 000,25

• 123,456,789.123456789 should be written as 123 456 789,123 456 789

• 4,000 should be written as 4000

Using sageTeX and sageTeX, SageMath's latex command, and LaTeX babel package, it is easy to replace the decimal point with a decimal comma. It is also easy to eliminate the commas for every 1000 factor. However, I haven't been able to put a small space instead.

I could use the siunitx LaTeX package, which has a command, \num, that does exactly this processing. However, it doesn't work with sageTeX's \sage command or any of it's environments. The only solution I can find is to apply the \num command directly to every number generated by SageMath via the latex command.

My problem is: I don't know how to do this, specially in cases where numbers are entries of a matrix, or the coefficients of a polynomial. So, how could I apply the \num command to every number independently using the latex command? 3 retagged

### Spanish numbers using LaTeX

Dear SageMath community,

I am currently writing a LaTeX document in Spanish that relies heavily on sageTeX for computations. The rules for writing numbers in Spanish are a little different from English ones. For example, we are prohibited from using commas to separate every 1000 factor, instead using a small space, only if the number is longer than four digits; otherwise, no sign should be used. On the other hand, the decimal point is actually a decimal comma. For example,

• 1,000,000.25 should be written as 1 000 000,25
• 123,456,789.123456789 should be written as 123 456 789,123 456 789
• 4,000 should be written as 4000

Using sageTeX, SageMath's latex command, and LaTeX babel package, it is easy to replace the decimal point with a decimal comma. It is also easy to eliminate the commas for every 1000 factor. However, I haven't been able to put a small space instead.

I could use the siunitx LaTeX package, which has a command, \num, that does exactly this processing. However, it doesn't work with sageTeX's \sage command or any of it's environments. The only solution I can find is to apply the \num command directly to every number generated by SageMath via the latex command.

My problem is: I don't know how to do this, specially in cases where numbers are entries of a matrix, or the coefficients of a polynomial. So, how could I apply the \num command to every number independently using the latex command?