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!
Anonymous
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.
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:
Would it still be too complex?
Obs.: I am not a programmer, it is just a suggestion!
As written above
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.