Skip to content

Commit

Permalink
Merge pull request #565 from serlo/sans-serif-math
Browse files Browse the repository at this point in the history
Sans serif math test
  • Loading branch information
Entkenntnis committed Sep 7, 2020
2 parents d287879 + 4d450ed commit 89666b9
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions src/components/content/math.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,19 @@ export interface MathProps {

export function Math(props: MathProps) {
const { inline = false } = props
let formula = props.formula

// make empty formulas clickable
if (!formula) {
formula = '\\,'
}
// use displaystyle for block formulas
if (!inline) {
formula = '\\displaystyle ' + formula
}
const formula = '\\sf ' + props.formula || '\\,'

const html = KaTeX.renderToString(formula, {
displayMode: false,
throwOnError: false,
strict: false,
})
// block formular use displaystyle
const html = KaTeX.renderToString(
inline ? formula : '\\displaystyle' + formula,
{
displayMode: false,
throwOnError: false,
strict: false,
}
)

return <KaTeXSpan dangerouslySetInnerHTML={{ __html: html }} />
}

0 comments on commit 89666b9

Please sign in to comment.