RE: Tabs in Macros in WinEdt 6
Daniele Giorgio Degiorgi <degiorgi <at> inf.ethz.ch>
2011-08-13 05:17:25 GMT
Many thanks for your hints.
The macro did not work because tabs but because dots: I use winedt 5 and 6
in two computers (old and new) and they have different settings: the old
used a comma to represent decimal dot and the new an effective dot.
In fact setting in tabs.ini
And changing , in \. In the macro worked.
What I miss now is an option to get the tab displayed as underlined >.
From: Gilbert Ritschard [mailto:Gilbert.Ritschard <at> unige.ch]
Sent: venerdì, 12. agosto 2011 10:02
To: winedt+list <at> wsg.net
Subject: Re: [WinEdt] Tabs in Macros in WinEdt 6
I use a macro named tab_to_tex.edt, with the following code (provided
to me by Alex, if I remember well):
// Convert tab to tab&
FindInString("%!0", "$[#9]$", 1,2, 1011, %!2+3);>
IfOK('ReplaceInString("%!0", "$[#9]$& ", %!1, %!2, 1, 0);','Stop;')|);
// Convert CR to \\CR
FindInString("%!0", "$[#13]$", 1,2, 1011, %!2+3);>
IfOK('ReplaceInString("%!0", "\\\\$[#13]$", %!1, %!2, 1,
InsText("%!0"); // Insert with no wrapping
The macro is assigned to a menu item (I have it in a "my_tools" menu,
but you can just add it for instance to "Tools")
CAPTION="Paste tab to TeX"
MACRO="Exe('%B\Contrib\My\tab_to_tex.edt');" // adapt the path
Usage: In Excel I just copy the wanted table, and then pressing
Ctrl+Alt+X in WinEdt I get the table with tab replaced by &, and end of
line by \\.
Alternatively, you can also use the Excel add-in:
http://www.ctan.org/tex-archive/support/excel2latex , with which you get
in addition the table environment.
Hope this helps.
On 12-Aug-11 9:07, Daniele Giorgio Degiorgi wrote:
> I have following problem.
> I get with cut+Paste a portion of an excel document in Winedt.
> Field Separator is a tab and I managed to have it represented with a
> underlined <.
> In a macro file I could use tabs in SetFindStr and SetReplaceStr.
> Running the macro I got a modified text that I could again with
> cut+paste transfer in an access document.
> This was with Winedt 5.
> With Winedt 6 the macro does not work anymore.
> I tried to change the defaults for tabs but it worked only partial: I
> got the tabs represented as underlined < in the text file but not in
> the macro (EDT document).
> I tried to change the tabs in the macro with $[#9]$ but after that the
> macro seems to have no effect. In fact $[#9]$ works with Winedt 5 but
> seems not to work in Winedt 6.
> Any Idea how I can get it to work?
> Many thanks in advance,
Gilbert Ritschard, Department of Economics and
Institute for Demographic and Life Course Studies,
University of Geneva, 40, bd du Pont-d'Arve, CH-1211 Genève 4, Switzerland