Comments (9)
This is yet another result of #366
When typesetting text in math, you should explicitly switch to the text font.
from typst.
Thanks @Enivex , but I don't see how this is at all related to fonts. A double quote on its own is ambiguous, and correct rendering depends on the context to determine which way the quotes should "point". As I understand, #[...]
does explicitly switch to text font.
Just to be clear, OP is just a minimal example, the real use case is something like the quotes in this:
The only way I could get these quotes correct was to use quote.l.double
and quote.r.double
, which is extremely clunky.
from typst.
. As I understand,
#[...]
does explicitly switch to text font.
No, this is incorrect. As long as you're inside an equation the math font is used. Which isn't really intended for typesetting text, and therefore will cause issues like this.
@cscherrer my suggestion for the time being is to define something like #let mtext = text.with(font: "text font name hereβ)
and then use $ 1 + 1 = 2 quad (#mtext["Profound" equation]) $
This will change, but the design hasn't been decided on yet.
from typst.
Thanks for the suggestion! That gets pretty close, but I'd like to keep the same font. If I do #context text.font
it says new computer modern
. Then if I do
#let mtext = text.with(font: "new computer modern")
$
1 + 1 &= 2 quad (#mtext["Profound" equation]) \
1 + 1 &= 2 quad (#text["Profound" equation])
$
I get
The first looks pretty good. I guess the last step is, instead of querying the font and then typing it in, how can I automate this? I tried
#let mtext = text.with(font: text.font)
but that gives an error.
from typst.
The first looks pretty good. I guess the last step is, instead of querying the font and then typing it in, how can I automate this? I tried
#let mtext = text.with(font: text.font)but that gives an error.
Unfortunately this is not possible, even adding the context keyword, because the font in the context where function would be used would be the math font. You have to hard code it.
from typst.
That very surprising that you can't just cast an observation from some context into a fixed variable, but I'll take your word for it. Thanks for the help :)
from typst.
There might be a misunderstanding. You can store an observation from a context into a fixed variable. But in this case, there is no good place to put the context (at least not automatically) because the font is already configured in the context passed to the equation show rule.
from typst.
Ok, if I put #context text.font
in body of my paper, it renders as "new computer modern". How would I instead put that in a fixed variable, say myfont
? Then I could follow it with
#let mtext = text.with(font: myfont)
Then I think calling mtext
from inside math mode would solve it. I don't need the context placed automatically.
from typst.
Ah, no, it doesn't work directly like that, I might have bee the that misunderstood. Everything depending on the context does need to be within the context. But if you have multiple nested contexts, then you can still save the observation from one and access it in the other:
#context {
let fill = text.fill
set text(fill: blue)
context {
let fill2 = text.fill
[fill is #fill and fill2 is #fill2]
}
}
from typst.
Related Issues (20)
- PDF A-3 - embeding xml into the exported document HOT 2
- Custom scoped functions HOT 1
- Thicker table (v)line becomes longer and exceeds the table bounds/borders HOT 10
- Add syntax highlighting for Svelte 5 HOT 8
- Typst panics after trying to parse an invalid `.sublime-syntax` file (syntect crate)
- CMYK gradient issues with PDF HOT 1
- Extra vertical space in two column list HOT 3
- Not works on MacOS 15 HOT 5
- closing parenthesis is not recognised in math formula in context block HOT 3
- Customize pages generated by `pagebreak(to:)` HOT 3
- Medium Online Video not working though defined in CSL
- Typst cannot type Chinese properly HOT 7
- Allow users to clean package cache & Hint for broken package cache
- Include `page` parameter to not disrupt current text flow
- Different format/style for footnote references instead of superscript
- Add STIX Two fonts to the list of embedded fonts within the CLI HOT 2
- Automatic capitalization of references
- Crate for downstream tooling HOT 3
- Footnote references do not respect numbering format
- `block` `spacing` is not being handled correctly HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typst.