2
$\begingroup$

I've have a Word document that I'd like to import to Mathematica. I could just copy and paste, but when I do, I lose the underlined text. Is there a way to get MS Word text into Mathematica while preserving the underlining of words.

$\endgroup$
3
  • $\begingroup$ whats you goal, formatted text in text cells? $\endgroup$
    – george2079
    Commented Jul 25, 2016 at 16:23
  • $\begingroup$ @george2079 I'm have underlined text that's important in a giant text file, and I want to simply isolate the underline text and use Mathematica functions on them. So yes, if the formatted text in the text cells had say, [Underlined]...Text...[/Underlined], isolating the underlined text, then yes. $\endgroup$
    – Sham Says
    Commented Jul 25, 2016 at 18:03
  • $\begingroup$ You can try saving as an RTF file and then importing. I bet from there you can answer your own question. $\endgroup$
    – chuy
    Commented Jul 25, 2016 at 18:59

1 Answer 1

5
$\begingroup$

You can transfer styled text from Word to Mathematica using an intermediate file rich-text format (.rtf). Here is how.

  1. In Mathematica create an empty text cell (Cmnd+7 in OS X). Do not move the insertion point out of this cell.
  2. In Word, select the text you want to copy and save as an .rtf file. I don't use Word, so I don't know if you do selection save or a selection export, but I'm pretty sure one or other is available because RTF is a Microsoft format.
  3. Go back to Mathematica and choose File... from the Insert menu. In the system file open dialog that appears, choose the .rtf file you just made and open it.
  4. You should now see your text with most of its formatting preserved. Underlined words will certainly be preserved.
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.