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

Invalid tex in regression lecture (and others?) #181

Closed
jlperla opened this issue Aug 13, 2021 · 6 comments · May be fixed by #202
Closed

Invalid tex in regression lecture (and others?) #181

jlperla opened this issue Aug 13, 2021 · 6 comments · May be fixed by #202
Assignees

Comments

@jlperla
Copy link
Member

jlperla commented Aug 13, 2021

The regression lecture is using unescaped latex in a name. This seems to work in the html renderer, but not in the katex one used in vscode jupyter notebooks.

That is,

$$
\log(\text{price}) = \beta_0 + \beta_1 \text{sqft_living} + \epsilon
$$

is incorrect and should be

$$
\log(\text{price}) = \beta_0 + \beta_1 \text{sqft\_living} + \epsilon
$$

or something similar.

We should look to see if there are other locations that could have this issue.

@jlperla
Copy link
Member Author

jlperla commented Aug 13, 2021

See https://github.com/QuantEcon/lecture-datascience.myst/blob/main/lectures/applications/regression.md

Is there a simple regex you could try in vscode to globally look for \text{ followed by a string followed by \ followed by more string, followed by }? If it is tricky to do, we can just fix them slowly. I am bad at regex so not sure if this is easy or not, but not worth more than 5 minutes.

@jbrightuniverse
Copy link
Collaborator

What we want is to find all incorrect instances, right? So would a better search string be searching for a _ between \text{ and } rather than a \?

@jlperla
Copy link
Member Author

jlperla commented Aug 13, 2021

Yes that is what I meant! Thanks!

@jlperla
Copy link
Member Author

jlperla commented Aug 13, 2021

But like I said, not worth more than 5 minutes.

The way to test this all is to generate these and check that it doesn't break in HTML, then with the deployed notebooks load them in vscode and its jupyter and see if it has a KaTeX parse error.

@jbrightuniverse
Copy link
Collaborator

Saving for my reference later: a working regex for this is:

(?<=\\text\{)[^\}]*?(?=_).*?(?=\})

(ensures phrase starts with \text{, ensures there is no } before a _, and after the _, has a closing })

@wupeifan
Copy link
Contributor

is this one updated already?

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

Successfully merging a pull request may close this issue.

4 participants