Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poor formatting of \kWh when used in conjunction with \per #752

Closed
dbitouze opened this issue Oct 26, 2024 · 3 comments
Closed

Poor formatting of \kWh when used in conjunction with \per #752

dbitouze opened this issue Oct 26, 2024 · 3 comments

Comments

@dbitouze
Copy link
Contributor

The following MCE shows that it is impossible to get right formatting for \kWh, defined as:

\siunitx_declare_unit:Nnn \kWh { \kilo \watt \hour }
  { inter-unit-product = }

when used in conjunction with \per:

\documentclass{article}
\usepackage{siunitx}
\begin{document}
\qty{1}{\kWh}

\qty{1}{\kWh\per\kg}

\qty[inter-unit-product =]{1}{\kWh\per\kg}
\end{document}

image

@dbitouze dbitouze changed the title Poor formatting of \kWh when used in conjunction with \per. Poor formatting of \kWh when used in conjunction with \per`. Oct 26, 2024
@dbitouze dbitouze changed the title Poor formatting of \kWh when used in conjunction with \per`. Poor formatting of \kWh when used in conjunction with \per. Oct 26, 2024
@dbitouze dbitouze changed the title Poor formatting of \kWh when used in conjunction with \per. Poor formatting of \kWh when used in conjunction with \per Oct 26, 2024
@josephwright
Copy link
Owner

To-be-expected. The \kWh unit is set up to do the non-standard spacing people tend to want for the unit as-is. However, it's defined as \kilo\watt\hour, so when used in a combination it reverts to the standard spacing. If you want a 'fixed' spacing, you'll need to do

\DeclareSIUnit\kWh{kWh}

or similar so that it's not actually linked to the constituent units.

@josephwright
Copy link
Owner

This is covered in the manual in 'Special considerations for the \kWh unit'.

@dbitouze
Copy link
Contributor Author

This is covered in the manual in 'Special considerations for the \kWh unit'.

Ah,indeed, sorry to not have noticed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants