question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Invalid LaTeX format for arcsec2

See original GitHub issue

astropy version 3.1.2

print (astropy.units.Unit("arcsec2").to_string("latex")) $\mathrm{{}^{\prime\prime}^{2}}$

This is invalid LaTeX because the same base string carries two exponents. The problem arises because the LaTeX string for arcsec uses an exponent to raise the primes above the baseline.

A quick fix would be to always enclose the LaTeX string for arcsec in curly braces, but the resulting layout is not so nice (the primes and the exponent are on the same level). The better fix would be to include the LaTeX string for arcsec in regular parentheses if and only if it carries an exponent.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
mhvkcommented, May 15, 2019

Hmm, I think with an exponent we should indeed not use the primes at all, but rather just $\mathrm{arcsec}^{2}$. Arguably this should happen in composite units as well (say, pix/arcsec). A change is not entirely trivial - the actual formatting is done in Latex.to_string in units/format/latex.py.

Note that there is already a special treatment for arcsec in si.py, in that only the un-prefixed unit is shown using primes. The same should also be done for arcmin and deg. Right now:

In [12]: u.mdeg.to_string('latex')
Out[12]: '$\\mathrm{m{}^{\\circ}}$'

(And the same for unicode output)

Possibly the simplest would be for the format dict to def_unit to include an extra latex_simple (or so) entry with the value that gets used when the unit is shown on its own.

0reactions
mhvkcommented, Sep 12, 2019

fixed by #9218

Read more comments on GitHub >

github_iconTop Results From Across the Web

siunitx arcsecond invalid arcformat - LaTeX Stack Exchange
I found a solution... I guess the \arc{}. command needs a final placeholder to know where it is in the sequence of degrees,...
Read more >
Errors - Overleaf, Online LaTeX Editor
An online LaTeX editor that's easy to use. No installation, real-time collaboration, version control, hundreds of LaTeX templates, and more.
Read more >
pandoc - exams2pandoc error message - invalid template
The default template is a LaTeX file plain.tex : ... And then you can call exams2pandoc(..., template = "myplain.tex") .
Read more >
Latex Instructions - Elsevier
You can download a set of files containing a template LaTeX manuscript, using the elsarticle class, plus associated BibTeX style files here. Although...
Read more >
TAPS Workflow - Association for Computing Machinery
incorrect template used - You need to use the proper Word templates. The "interim" template is not compatible with TAPS. document not validated...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found