LaTeX forum ⇒ Math & Sciencesquared values in SIunitx for resolutions

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
fifo
Posts: 3
Joined: Fri Apr 24, 2020 12:09 pm

squared values in SIunitx for resolutions

Postby fifo » Fri May 29, 2020 2:12 pm

Dear all,

spent half the day to find a solution for this, but since now I didn't. In my thesis I write a lot about image and volume resolutions. Those resolutions are all isometric, so I'd like to shorten the notation to a squared or cubed value. Unfortunately SIunitx does not allow the modifiers \squared or \cubed in the value part of \SI. I attached this MWE, where I implemented my desired visualization manually in math mode:

Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. \documentclass{scrbook}
  2.  
  3. \usepackage[T1]{fontenc}
  4. \usepackage[utf8]{inputenc}
  5.  
  6. \usepackage{siunitx}
  7. \DeclareSIUnit\pixel{px}
  8.  
  9.  
  10. \begin{document}
  11.  
  12. This is about my new favourite image resolution of \SI{100x100}{\pixel}.
  13. I would like to write it in a shorter notation, because of its isometric nature:
  14. $100^2\,\text{px}$. How do I implement that with SIunitx?
  15.  
  16. \end{document}


Does anybody know a way to implement this with SIunitx directly?

Thanks in advance :)
Attachments
MWE-I.tex
Minimal Working Example
(391 Bytes) Downloaded 5 times

ph1sm
Posts: 1
Joined: Wed Jul 29, 2020 1:17 pm

Postby ph1sm » Wed Jul 29, 2020 1:20 pm

Have you tried the lowercase si command: value\si{unit}?

e.g. $100^2$\si{\pixel}

Bartman
Posts: 96
Joined: Fri Jan 03, 2020 2:39 pm

Postby Bartman » Wed Jul 29, 2020 2:15 pm

Use the parse-numbers option:

Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. \documentclass{scrbook}
  2.  
  3. %\usepackage[utf8]{inputenc}% see issue 28 in ltnews on CTAN
  4. \usepackage[T1]{fontenc}
  5. \usepackage{lmodern}
  6. \usepackage{siunitx}
  7.  
  8. \DeclareSIUnit\pixel{px}
  9.  
  10. \begin{document}
  11. \SI[parse-numbers=false]{100^2}{\pixel}
  12. \end{document}


Return to “Math & Science”

Who is online

Users browsing this forum: No registered users and 4 guests