Text Formatting ⇒ Copy/paste text maintaining formatting
Copy/paste text maintaining formatting
Hello,
how can I copy/paste text from Microsoft Word or a web site maintaining its formatting? (e.g. italic, bold etc)
A specific thing I'd like to maintain is the paragraph division, in order to avoid to do it manually.
Thank you
how can I copy/paste text from Microsoft Word or a web site maintaining its formatting? (e.g. italic, bold etc)
A specific thing I'd like to maintain is the paragraph division, in order to avoid to do it manually.
Thank you
Last edited by ffarr on Wed Apr 27, 2011 3:04 am, edited 1 time in total.
NEW: TikZ book now 40% off at Amazon.com for a short time.

Copy/paste text maintaining formatting
You can try writer2latex, which works nicely with Libreoffice (which is free software, so you can give it a try without having to pay a cent). I've found this solution to be quite satisfying. However, be aware that sometimes resulting .tex file can be pretty messy, depending on the complexity of the source document.
Regarding paragraph separation, I'm not sure what's the deal? If you want paragraphs to be separated by vertical space instead of first line indent, simply redefine parindent and parskip lengths, e.g.:
Regarding paragraph separation, I'm not sure what's the deal? If you want paragraphs to be separated by vertical space instead of first line indent, simply redefine parindent and parskip lengths, e.g.:
Code: Select all
\setlength{\parindent}{0pt}
\setlength{\parskip}{12pt plus 2pt minus 2pt}
Copy/paste text maintaining formatting
Maybe I wasn't very clear, I beg your pardon for my poor English.
What do I have to do?
I have to copy text FROM word TO LaTex (in my case, I'm using TeXnicCenter)
What's the problem?
The problem is that, after pasting it in TeXnicCenter, I have to manually modify it. I've got to put the bolds, italics etc, to change all the ' ", to separate manually the paragraphs, inserting a blank line among them.
When I copy some text from word to TeXnicCentre, the result is text without formatting and without line breaks.
Is there a way to automatically obtaining formatting in TeXnicCentre?
What do I have to do?
I have to copy text FROM word TO LaTex (in my case, I'm using TeXnicCenter)
What's the problem?
The problem is that, after pasting it in TeXnicCenter, I have to manually modify it. I've got to put the bolds, italics etc, to change all the ' ", to separate manually the paragraphs, inserting a blank line among them.
When I copy some text from word to TeXnicCentre, the result is text without formatting and without line breaks.
Is there a way to automatically obtaining formatting in TeXnicCentre?
Copy/paste text maintaining formatting
Ok I'll try you tip.meho_r wrote:You can try writer2latex, which works nicely with Libreoffice (which is free software, so you can give it a try without having to pay a cent). I've found this solution to be quite satisfying. However, be aware that sometimes resulting .tex file can be pretty messy, depending on the complexity of the source document.
Regarding paragraph separation, I'm not sure what's the deal? If you want paragraphs to be separated by vertical space instead of first line indent, simply redefine parindent and parskip lengths, e.g.:Code: Select all
\setlength{\parindent}{0pt} \setlength{\parskip}{12pt plus 2pt minus 2pt}
About paragraph separation: my problem is that when I past the text I have to manually insert paragraphs breaks (I do it putting a blank line between them), it's not about the separation in pts.
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Copy/paste text maintaining formatting
Your understanding of how TeX works is wrong. It processes files which are written in plain text. Did you try to copy formatted text from a word processor into a simple text editor? Did it preserve the formatting? I guess not. And even if it would do so, this wouldn't help you. (La)TeX is a typesetting system with a markup language that passes its formatting by commands to the compiler. And by the way, this isn't really a LaTeX problem but more a problem between an editor and a word processor. LaTeX editors simply neglect all formatting tags from the clipboard. And what did you expect? That after you copied italicized text from a word processor to your LaTeX editor and this would insert \emph{italicized text} or \textit{italicized text} to your source code? Then you are off the track.
Thorsten
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Copy/paste text maintaining formatting
I understand your point, but I'm afraid you don't get mine.
I have to convert a lot of text in TeX and right now if I copy:
I obtain (in the PDF):
So in TeXnicCenter I have to put:
When you have to do it manually one thousand times, it's a bit annoying..
I have to convert a lot of text in TeX and right now if I copy:
Code: Select all
Lorem ipsum.
Lorem ipsum.
Code: Select all
Lorem ipsum. Lorem ipsum.
Code: Select all
Lorem ipsum.
Lorem ipsum.
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Copy/paste text maintaining formatting
But I think I got you at least halfway. And in your initial post you talked about italics and bold text. TeX interprets the contents of input files in a certain way. And this is one of them. New paragraphs are introduced by a blank line, not only by a carriage return. Conversion tools may help. Otherwise I'm afraid you will have to live with it if you want to continue using TeX.ffarr wrote:I understand your point, but I'm afraid you don't get mine. […]
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Copy/paste text maintaining formatting
Simply put:
1. If you want to preserve formatting completely or partly, conversion is probably the only way.
2. If only paragraph separation is important, you can use regular expressions to replace carriage returns with carriage return + an empty line. E.g., in LibreOffice/OpenOffice.org that is achieved by searching for $ and replacing it with \n\n (of course, with "regular expressions" activated in the search dialog).
You can use regular expressions to mark italics/bold too, e.g.
Search for (with formatting set to italic): (.*?)
Replace with: \emph{$0}
1. If you want to preserve formatting completely or partly, conversion is probably the only way.
2. If only paragraph separation is important, you can use regular expressions to replace carriage returns with carriage return + an empty line. E.g., in LibreOffice/OpenOffice.org that is achieved by searching for $ and replacing it with \n\n (of course, with "regular expressions" activated in the search dialog).
You can use regular expressions to mark italics/bold too, e.g.
Search for (with formatting set to italic): (.*?)
Replace with: \emph{$0}
Re: Copy/paste text maintaining formatting
Actually, writer2latex for liberoffice works fine for me, so I'm going to mark this thread as resolved.
Thank you all!
Thank you all!