Skip to content

Commit

Permalink
fix: fixed serialization to LaTeX which was occasionally missing spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
arnog committed Jun 24, 2024
1 parent a5903c3 commit d2c7468
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@

### Issues Resolved

- The serialization of some expressions to LaTeX could result in some spaces
being omitted. For example, `\lnot p` would serialize as `\lnotp`.
- **#2403** The virtual keyboard Keycap Variants panel was positioned incorrectly
when the page used a RTL layout direction.
- In the virtual keyboard, the background of the variant panel was sometimes
Expand Down
4 changes: 2 additions & 2 deletions src/core/modes-math.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ export class MathMode extends Mode {
function emitBoldRun(run: Atom[], options: ToLatexOptions): string[] {
return getPropertyRuns(run, 'bold').map((x) => {
const weight = weightString(x[0]);
if (weight !== 'bold') return emitVariantRun(x, options).join('');
if (weight !== 'bold') return joinLatex(emitVariantRun(x, options));

// If the parent is already bold, don't emit the bold command
if (weightString(x[0].parent!) === 'bold')
Expand All @@ -266,7 +266,7 @@ function emitBoldRun(run: Atom[], options: ToLatexOptions): string[] {
// (i.e. greek letters, operators, variants, etc...)

// Get the content of the run
const value = x.map((x) => x.value ?? '').join('');
const value = joinLatex(x.map((x) => x.value ?? ''));
if (/^[a-zA-Z0-9]+$/.test(value)) {
return latexCommand('\\mathbf', joinLatex(emitVariantRun(x, options)));
}
Expand Down

0 comments on commit d2c7468

Please sign in to comment.