[Solved] ChatGPT math equations don't paste as expected

Discuss the word processor
Locked
rayroshi
Posts: 45
Joined: Mon Nov 16, 2009 1:54 am
Location: Washington State, USA

[Solved] ChatGPT math equations don't paste as expected

Post by rayroshi »

Using Windows 10 and OpenOffice Writer, I am trying to copy and paste mathematical statements, but when pasting them, the terms are often doubled; e.g., if I were to try pasting "ϕ(n)=(p−1)×(q−1)ϕ," it appears as "ϕ(n)=(p−1)×(q−1)ϕ(n)=(p−1)×(q−1)." So, if dealing with large mathematical paragraphs, this becomes a time-consuming nightmare if I then have to go through the whole thing, manually deleting things.

Is there any way avoid this repetition? Any help would be much appreciated.
Last edited by MrProgrammer on Fri Jan 24, 2025 4:36 pm, edited 2 times in total.
Reason: Tagged ✓ [Solved] Duplication is caused by ChatGPT's strange HTML; Try Markdown formatting
OpenOffice.org 4.1.2 Windows 10
FJCC
Moderator
Posts: 9625
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Can't paste mathematical notation

Post by FJCC »

Do I understand you correctly that your mathematical statements are plain text and not formula objects? If so, Writer would not treat them differently than any other text. Do you not see double pasting when you copy and paste text with only roman letters?
What happens if you paste using a different method than your standard one? If you usually paste with Ctrl + V, try using the menu Edit -> Paste. Does the problem persist?
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
User avatar
Hagar Delest
Moderator
Posts: 33633
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: Can't paste mathematical notation

Post by Hagar Delest »

From where do you paste the strings?
It may come from an object that has metadata (in this case that would be identical to the displayed string) and then when pasted you get both strings.
Have you tried other paste special options?
LibreOffice 25.2 on Linux Mint Debian Edition (LMDE 7 Gigi) and 25.2 portable on Windows 11.
User avatar
MrProgrammer
Moderator
Posts: 5432
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Can't paste mathematical notation

Post by MrProgrammer »

Hagar Delest wrote: Thu Jan 09, 2025 9:06 am From where do you paste the strings?
According to these topics, they are probably pasting from an unspecified web page which has metadata.
[Solved] Darken Text In a Text Box
[Dropped] Preserve math format when pasting into Writer

rayroshi wrote: Thu Jan 09, 2025 6:08 am … when pasting them, the terms are often doubled …
Web pages may have lots of content present which the web browser has been told not to display. Copy/paste to Writer can therefore produce unexpected results, because Writer is not a web browser and cannot display the copied data the same way a web browser can. Review the advice given in your earlier topics. For some web pages Edit → Paste Unformatted may create text which you can then place in a Formula Object (Insert → Object → Formula). In general you will need a Formula Object to properly display mathematical equations in Writer. You will need to create that yourself; the object won't be available on a web page for you to copy.

The path of least effort may be to place an image of the formula from the web page in your Writer document.
[Tutorial] Some useful hints on using images

If this solved your problem please go to your first post use the Edit ✏️ button and add [Solved] to the start of the Subject field. Select the green checkmark icon at the same time.
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.7.8, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
rayroshi
Posts: 45
Joined: Mon Nov 16, 2009 1:54 am
Location: Washington State, USA

Re: Can't paste mathematical notation

Post by rayroshi »

Thanks to all of you for your responses; I really appreciate it.

I am pasting the responses that I get from ChatGTP, so I don't really know what kind of format in which they are written; don't know if that information helps you to help me or not, though.
OpenOffice.org 4.1.2 Windows 10
Bill
Volunteer
Posts: 8952
Joined: Sat Nov 24, 2007 6:48 am

Re: Can't paste mathematical notation

Post by Bill »

Please provide a sample document or tell us how to reproduce the problem.
AOO 4.1.14 on Ubuntu MATE 22.04
User avatar
Hagar Delest
Moderator
Posts: 33633
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: Can't paste mathematical notation

Post by Hagar Delest »

If you paste in a text editor (like Notepad) what do you get? Then copy that and paste it in Writer.
LibreOffice 25.2 on Linux Mint Debian Edition (LMDE 7 Gigi) and 25.2 portable on Windows 11.
rayroshi
Posts: 45
Joined: Mon Nov 16, 2009 1:54 am
Location: Washington State, USA

Re: Can't paste mathematical notation

Post by rayroshi »

Hi Bill, thanks for responding. Okay, here's an example of a simple problem that I am using just as an example. It was posted to ChatGTP and then the answer was copied and pasted into a blank Writer document. I hope this helps:

To find the derivative of the function f(x)=4x3f(x) = 4x^3f(x)=4x3, we will use the power rule for derivatives.
Power Rule:
The power rule states that if you have a term of the form axnax^naxn, where aaa is a constant and nnn is a positive integer, the derivative is:
ddx(axn)=a⋅n⋅xn−1\frac{d}{dx}(ax^n) = a \cdot n \cdot x^{n-1}dxd​(axn)=a⋅n⋅xn−1
Now, applying this rule to the function f(x)=4x3f(x) = 4x^3f(x)=4x3:
1. Identify the constant a=4a = 4a=4 and the exponent n=3n = 3n=3.
2. Apply the power rule: Multiply the constant 444 by the exponent 333, then subtract 1 from the exponent.
f′(x)=4⋅3⋅x3−1=12x2f'(x) = 4 \cdot 3 \cdot x^{3-1} = 12x^2f′(x)=4⋅3⋅x3−1=12x2
Final result:
The derivative of f(x)=4x3f(x) = 4x^3f(x)=4x3 is:
f′(x)=12x2f'(x) = 12x^2f′(x)=12x2
OpenOffice.org 4.1.2 Windows 10
rayroshi
Posts: 45
Joined: Mon Nov 16, 2009 1:54 am
Location: Washington State, USA

Re: Can't paste mathematical notation

Post by rayroshi »

Hi Hagar. Thanks for your help. I think you may be onto something.

Okay, following your suggestion, I tried pasting ChatGTP's answer to this simple calculus problem: "What is the first derivative of 4x^3?"

I then copied ChatGTP's answer into Wordpad, as you recommended, and here's what I got:

The first derivative of 4x34x3 can be found using the power rule of differentiation, which states:
ddx(xn)=n⋅xn−1
dxd​(xn)=n⋅xn−1

For 4x34x3, apply the power rule:
ddx(4x3)=4⋅3x3−1=12x2
dxd​(4x3)=4⋅3x3−1=12x2

So, the first derivative of 4x34x3 is:
12x2
12x2

So, as you can see, it doesn't appear to be an Openoffice problem, because it was already showing up in a 'doubled' form, even in Wordpad, which means that just the act of copying it somehow makes it appear double. How to I get around that?
OpenOffice.org 4.1.2 Windows 10
User avatar
Hagar Delest
Moderator
Posts: 33633
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: Can't paste mathematical notation

Post by Hagar Delest »

It seems that this how the HTML is formatted in the chatGPT interface. Thus not much to do I fear.
Just use a text editor to remove the added lines before copying and pasting that in Writer.

Please add [Solved] at the beginning of the title in your first post (top of the topic) with the 🖉 button if your issue has been fixed (I agree it's only a workaround here).
LibreOffice 25.2 on Linux Mint Debian Edition (LMDE 7 Gigi) and 25.2 portable on Windows 11.
rayroshi
Posts: 45
Joined: Mon Nov 16, 2009 1:54 am
Location: Washington State, USA

Re: Can't paste mathematical notation

Post by rayroshi »

Hi Hagar.

Okay, well it looks like I'm just stuck doing it manually. Thanks for your help anyway! I really appreciate it.

--Ray Cole
OpenOffice.org 4.1.2 Windows 10
User avatar
Hagar Delest
Moderator
Posts: 33633
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: Can't paste mathematical notation

Post by Hagar Delest »

I have asked to perplexity.ai and it seems that there are workarounds:
To prevent double quotes when pasting from ChatGPT, you can follow these steps:
1. Ask ChatGPT to format its response in Markdown4. This will help preserve formatting and avoid issues with quotes.
2. When copying the text, select and drag the entire response instead of using the copy button4. This method helps maintain the original formatting.
3. If you're pasting into a document editor like Google Docs, drag and drop the selected text directly from ChatGPT into the document4. This technique often preserves formatting better than traditional copy-paste.
LibreOffice 25.2 on Linux Mint Debian Edition (LMDE 7 Gigi) and 25.2 portable on Windows 11.
Locked