johanvx / typst-undergradmath

A Typst port of undergradmath
Creative Commons Attribution Share Alike 4.0 International
109 stars 7 forks source link

Simpler approach to get `\varnothing` in LaTeX (slashed circle empty set) #40

Closed CarrotDLaw closed 4 months ago

CarrotDLaw commented 4 months ago

In the latest version of Typst, the following code can correctly output nothing in slashed circle shaped without any semantic ambiguities using the default New Computer Modern Math font. Alternative fonts or using diameter as nothing is no longer needed. More reference here.

#show math.equation: text.with(features: ("cv01",))

$
nothing quad &"nothing" &"U+2205" \
diameter quad &"diameter" &"U+2300"
$
image

The documentation of New Computer Modern font has been updated so the referenced section number might need to be updated as well.

johanvx commented 4 months ago

Thanks! I'll update the document in the near future.

johanvx commented 4 months ago

I couldn't find a good way to express it while keeping 2-page layout, so I decided to 'invite' readers to read Typst Examples Book 😝 .

CarrotDLaw commented 4 months ago

In the latest version of Typst, the following code can correctly output nothing in slashed circle shaped without any semantic ambiguities using the default New Computer Modern Math font. Alternative fonts or using diameter as nothing is no longer needed. More reference here.

#show math.equation: text.with(features: ("cv01",))

$
nothing quad &"nothing" &"U+2205" \
diameter quad &"diameter" &"U+2300"
$
image

The documentation of New Computer Modern font has been updated so the referenced section number might need to be updated as well.

Would the updated one be a bit misleading? When using cv01, nothing is not diameter U+2300. nothing can be correctly shown as U+2205 in slashed circle shape. The updated solution (let varnothing = math.diamter) will makevarnothing to be U+2300, which is wrong in semantic. The best solution should be simply enabling on cv01 for New Computer Modern font in Typst.

johanvx commented 4 months ago

Would the updated one be a bit misleading? When using CV01, nothing is NOT diameter U+2300. nothing CAN be correctly shown as U+2205 in slashed circle shape. The updated solution (let varnothing = math.diamter) will makevarnothing to be U+2300, which is wrong in semantic. The best solution should be simply enabling on CV01 for New Computer Modern font in Typst.

I'm not so sure, but let's do a quick check:

  1. copy-paste your code and add a Fira Math version duplication (https://typst.app/project/rZiKl-oIw0jTMEb5IAJ1p5) and download the compiled PDF.

    #set page(width: auto, height: auto, margin: 1em)
    
    #show math.equation: text.with(features: ("cv01",))
    
    $
     nothing quad &"nothing" &"U+2205" \
     diameter quad &"diameter" &"U+2300"
    $
    
    #show math.equation: text.with(features: (:), font: "Fira Math")
    
    $
     nothing quad &"nothing" &"U+2205" \
     diameter quad &"diameter" &"U+2300"
    $
  2. copy the two New Computer Modern Math symbols and paste them one by one to https://www.compart.com/en/unicode. It turns out that the two symbols are all “⌀” U+2300 Diameter Sign Unicode Character.

  3. do the same check with the two Fira Math symbols. It turns out that the first symbol is “∅” U+2205 Empty Set Unicode Character and the second “⌀” U+2300 Diameter Sign Unicode Character.

CarrotDLaw commented 4 months ago

I have tried and you are right!! The reason my code works as expected is that I have been using the (Typst Preview Extension)[https://github.com/Enter-tainer/typst-preview] to check the output. It is correctly nothing on the preview output, but not the final PDF output. Now I'm not sure whose fault it is.

CarrotDLaw commented 4 months ago

Guiding readers to read the possible solutions and let them choose their own way is good enough.