Menu

#1041 "Past as Latex" to convert automatically italics and bold into Latex format

open
nobody
1
2016-10-18
2016-04-04
Anonymous
No

Hi, would it be possible for the feature "Past as Latex" to convert automatically text copied from other sources that presents Italics or bold text into the Latex text format?

For example the text copied from another source:
"This is an important test for the purpose appointed."

To past into Latex as:
"This is an \textit{important test} for the \textbf{purpose appointed}."
While using the "Past as Latex" feature.

There are some word processors that acknowledge these formating characteristics while pasting text that carries such attributes. But I am not sure this is possible in Latex editors.

Justification: This is would be an useful tool for those writing theses or academic papers while citing others authors through quotes or quotations without the need to always re-check what was copied into the edited file to match the source. This would save time and avoid errors for eventually forgetting to re-check the text.

Thanks for your attention and great efforts in building this fantastic software!

Discussion

  • Tim Hoffmann

    Tim Hoffmann - 2016-04-04

    Theoretically yes. In such cases the clipboard usually also contains a RTF representation of the data. One would just need an RTF to LaTeX converter.

    And here comes the practical no. I'm not aware of any standard tool that is shipped with latex distributions, so most likely there's no program we could delegate the conversion to. Implementing a converter ourselves is out of question. Even for a simple converter, that only keeps bold and italics, the converter must know much more of the format because it has to discard everything else. Fuirthermore then there would be the question, which parts of information to maintain, font faces ok, but fontsizes, font types, images, itemization.

    IMO, this topic is far too complex for the expected gain.

    Note: There seem to be some standalone latex tools that are able to convert complete doc/odf/rtf documents. Maybe you could use these and copy from the resulting latex file.

     
  • hehe_br

    hehe_br - 2016-10-15

    Hi, this idea is interesting.
    Just a thought, but could this be done by converting only the RTF code that has the information related to bold, italics and underline on the clipboard content using a regular expression (regex) to the related latex formats?
    This http://www.biblioscape.com/rtf15_spec.htm gives these codes:

    \b Bold.
    \i Italic.

    \ul Continuous underline

    The control properties of certain control words (such as bold, italic, keep together, and so on) have only two states. When such a control word has no parameter or has a nonzero parameter, it is assumed that the control word turns on the property. When such a control word has a parameter of 0 , it is assumed that the control word turns off the property. For example, \b turns on bold, whereas \b0 turns off bold.

    Would it still be too complex?
    Obs.: I am not a programmer, it is just a suggestion!

     
  • Tim Hoffmann

    Tim Hoffmann - 2016-10-18

    As written above

    Even for a simple converter, that only keeps bold and italics, the converter must know much more of the format because it has to discard everything else.

    Even if you intend to only translate a subset of commands (e,g, \b, \i, \u) you'll still have to understand the complete RTF definition and parse the file for the prurpose of separating control information from plain text.

     

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.