Skip to content

BUG: Claude: Inline math clipped with extra space #749

@KraXen72

Description

@KraXen72

Version (please complete the following information):

  • OS: Fedora Linux 43
  • Browser: Vivaldi
  • Web Clipper version: 1.2.1
  • Obsidian version: N/A, I use copy to clipboard in clipper.

Describe the bug

Selecting some text with inline math on claude and clipping introduces additional spaces before the closing $ in inline math, making it fail to render.

These four are collectively called the **standard decision problems** for formal language classes.

- **A (Acceptance):** Does machine $M $ accept string $w $? i.e., is $w \in L(M) $?
- **E (Emptiness):** Does machine $M $ accept any string at all? i.e., is $L(M) = \emptyset $?
- **ALL (Universality):** Does machine $M $ accept every possible string? i.e., is $L(M) = \Sigma^* $?
- **EQ (Equivalence):** Do two machines $M_1 $ and $M_2 $ accept the same language? i.e., is $L(M_1) = L(M_2) $?

Expected behavior

What did you expect to happen?

It would get clipped without the space inserted before the $, rendering the latex correctly.
By clicking the copy button in claude, we get this:

These four are collectively called the **standard decision problems** for formal language classes.

- **A (Acceptance):** Does machine $M$ accept string $w$? i.e., is $w \in L(M)$?
- **E (Emptiness):** Does machine $M$ accept any string at all? i.e., is $L(M) = \emptyset$?
- **ALL (Universality):** Does machine $M$ accept every possible string? i.e., is $L(M) = \Sigma^*$?
- **EQ (Equivalence):** Do two machines $M_1$ and $M_2$ accept the same language? i.e., is $L(M_1) = L(M_2)$?

However, I do not want to always do this since i usually select some text, and then invoke the clipper with a shortcut to only clip that part.

URLs where the bug occurs: claude.ai

Any specific web pages where the bug can be replicated.

To reproduce

raw html from claude.ai:
given this html:

<div class="row-start-1 col-start-1 relative z-[2] min-w-0"><div><div class="standard-markdown grid-cols-1 grid [&amp;_&gt;_*]:min-w-0 gap-3 standard-markdown"><p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">These four are collectively called the <strong>standard decision problems</strong> for formal language classes.</p>
<ul class="[li_&amp;]:mb-0 [li_&amp;]:mt-1 [li_&amp;]:gap-1 [&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-disc flex flex-col gap-1 pl-8 mb-3">
<li class="whitespace-normal break-words pl-2"><strong>A (Acceptance):</strong> Does machine <span class="katex" role="math"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>M</mi></mrow><annotation encoding="application/x-tex">M
</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height: 0.6833em;"></span><span class="mord mathnormal" style="margin-right: 0.10903em;">M</span></span></span></span> accept string <span class="katex" role="math"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>w</mi></mrow><annotation encoding="application/x-tex">w
</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height: 0.4306em;"></span><span class="mord mathnormal" style="margin-right: 0.02691em;">w</span></span></span></span>? i.e., is <span class="katex" role="math"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>w</mi><mo></mo><mi>L</mi><mo stretchy="false">(</mo><mi>M</mi><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">w \in L(M)
</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height: 0.5782em; vertical-align: -0.0391em;"></span><span class="mord mathnormal" style="margin-right: 0.02691em;">w</span><span class="mspace" style="margin-right: 0.2778em;"></span><span class="mrel"></span><span class="mspace" style="margin-right: 0.2778em;"></span></span><span class="base"><span class="strut" style="height: 1em; vertical-align: -0.25em;"></span><span class="mord mathnormal">L</span><span class="mopen">(</span><span class="mord mathnormal" style="margin-right: 0.10903em;">M</span><span class="mclose">)</span></span></span></span>?
</li>
<li class="whitespace-normal break-words pl-2"><strong>E (Emptiness):</strong> Does machine <span class="katex" role="math"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>M</mi></mrow><annotation encoding="application/x-tex">M
</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height: 0.6833em;"></span><span class="mord mathnormal" style="margin-right: 0.10903em;">M</span></span></span></span> accept any string at all? i.e., is <span class="katex" role="math"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>L</mi><mo stretchy="false">(</mo><mi>M</mi><mo stretchy="false">)</mo><mo>=</mo><mi mathvariant="normal"></mi></mrow><annotation encoding="application/x-tex">L(M) = \emptyset
</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height: 1em; vertical-align: -0.25em;"></span><span class="mord mathnormal">L</span><span class="mopen">(</span><span class="mord mathnormal" style="margin-right: 0.10903em;">M</span><span class="mclose">)</span><span class="mspace" style="margin-right: 0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right: 0.2778em;"></span></span><span class="base"><span class="strut" style="height: 0.8056em; vertical-align: -0.0556em;"></span><span class="mord"></span></span></span></span>?
</li>
<li class="whitespace-normal break-words pl-2"><strong>ALL (Universality):</strong> Does machine <span class="katex" role="math"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>M</mi></mrow><annotation encoding="application/x-tex">M
</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height: 0.6833em;"></span><span class="mord mathnormal" style="margin-right: 0.10903em;">M</span></span></span></span> accept every possible string? i.e., is <span class="katex" role="math"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>L</mi><mo stretchy="false">(</mo><mi>M</mi><mo stretchy="false">)</mo><mo>=</mo><msup><mi mathvariant="normal">Σ</mi><mo></mo></msup></mrow><annotation encoding="application/x-tex">L(M) = \Sigma^*
</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height: 1em; vertical-align: -0.25em;"></span><span class="mord mathnormal">L</span><span class="mopen">(</span><span class="mord mathnormal" style="margin-right: 0.10903em;">M</span><span class="mclose">)</span><span class="mspace" style="margin-right: 0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right: 0.2778em;"></span></span><span class="base"><span class="strut" style="height: 0.6887em;"></span><span class="mord"><span class="mord">Σ</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height: 0.6887em;"><span style="top: -3.063em; margin-right: 0.05em;"><span class="pstrut" style="height: 2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mbin mtight"></span></span></span></span></span></span></span></span></span></span></span>?
</li>
<li class="whitespace-normal break-words pl-2"><strong>EQ (Equivalence):</strong> Do two machines <span class="katex" role="math"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>M</mi><mn>1</mn></msub></mrow><annotation encoding="application/x-tex">M_1
</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height: 0.8333em; vertical-align: -0.15em;"></span><span class="mord"><span class="mord mathnormal" style="margin-right: 0.10903em;">M</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height: 0.3011em;"><span style="top: -2.55em; margin-left: -0.109em; margin-right: 0.05em;"><span class="pstrut" style="height: 2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">1</span></span></span></span><span class="vlist-s">&ZeroWidthSpace;</span></span><span class="vlist-r"><span class="vlist" style="height: 0.15em;"><span></span></span></span></span></span></span></span></span></span> and <span class="katex" role="math"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>M</mi><mn>2</mn></msub></mrow><annotation encoding="application/x-tex">M_2
</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height: 0.8333em; vertical-align: -0.15em;"></span><span class="mord"><span class="mord mathnormal" style="margin-right: 0.10903em;">M</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height: 0.3011em;"><span style="top: -2.55em; margin-left: -0.109em; margin-right: 0.05em;"><span class="pstrut" style="height: 2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span><span class="vlist-s">&ZeroWidthSpace;</span></span><span class="vlist-r"><span class="vlist" style="height: 0.15em;"><span></span></span></span></span></span></span></span></span></span> accept the same language? i.e., is <span class="katex" role="math"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>L</mi><mo stretchy="false">(</mo><msub><mi>M</mi><mn>1</mn></msub><mo stretchy="false">)</mo><mo>=</mo><mi>L</mi><mo stretchy="false">(</mo><msub><mi>M</mi><mn>2</mn></msub><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">L(M_1) = L(M_2)
</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height: 1em; vertical-align: -0.25em;"></span><span class="mord mathnormal">L</span><span class="mopen">(</span><span class="mord"><span class="mord mathnormal" style="margin-right: 0.10903em;">M</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height: 0.3011em;"><span style="top: -2.55em; margin-left: -0.109em; margin-right: 0.05em;"><span class="pstrut" style="height: 2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">1</span></span></span></span><span class="vlist-s">&ZeroWidthSpace;</span></span><span class="vlist-r"><span class="vlist" style="height: 0.15em;"><span></span></span></span></span></span></span><span class="mclose">)</span><span class="mspace" style="margin-right: 0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right: 0.2778em;"></span></span><span class="base"><span class="strut" style="height: 1em; vertical-align: -0.25em;"></span><span class="mord mathnormal">L</span><span class="mopen">(</span><span class="mord"><span class="mord mathnormal" style="margin-right: 0.10903em;">M</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height: 0.3011em;"><span style="top: -2.55em; margin-left: -0.109em; margin-right: 0.05em;"><span class="pstrut" style="height: 2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span><span class="vlist-s">&ZeroWidthSpace;</span></span><span class="vlist-r"><span class="vlist" style="height: 0.15em;"><span></span></span></span></span></span></span><span class="mclose">)</span></span></span></span>?
</li>
</ul></div></div></div>

FWIW pasting this into the defuddle playground parses it as:

These four are collectively called the **standard decision problems** for formal language classes.

- **A (Acceptance):** Does machine $M$ accept string $w$ ? i.e., is $w \in L(M)$ ?
- **E (Emptiness):** Does machine $M$ accept any string at all? i.e., is $L(M) = \emptyset$ ?
- **ALL (Universality):** Does machine $M$ accept every possible string? i.e., is $L(M) = \Sigma^*$ ?
- **EQ (Equivalence):** Do two machines $M_1$ and $M_2$ accept the same language? i.e., is $L(M_1) = L(M_2)$ ?

So i think the issue might be in the select -> clip part in clipper, not defuddle.

Your template file

{
	"schemaVersion": "0.1.0",
	"name": "Content only (filtered)",
	"behavior": "create",
	"noteContentFormat": "{{contentHtml|remove_html:(\".citation\")|remove_tags:(\"iframe\")|markdown}}",
	"properties": [],
	"triggers": [
		"https://www.perplexity.ai",
		"https://claude.ai"
	],
	"noteNameFormat": "{{title}}",
	"path": "clippings"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions