RE: Tabs in Macros in WinEdt 6
Daniele Giorgio Degiorgi <degiorgi <at> inf.ethz.ch>
2011-08-13 05:17:25 GMT
Hi Gilbert,
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
TAB_EXPAND=2
and
TAB_ALLOW_KEYBOARD=1
And changing , in \. In the macro worked.
What I miss now is an option to get the tab displayed as underlined >.
-----Original Message-----
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
Hi Daniel,
I use a macro named tab_to_tex.edt, with the following code (provided
to me by Alex, if I remember well):
CopyFromClipboard(0);
// Convert tab to tab&
LetRegNum(1, 0);
LetRegNum(2, -3);
Loop(!|>
FindInString("%!0", "$[#9]$", 1,2, 1011, %!2+3);>
IfOK('ReplaceInString("%!0", "$[#9]$& ", %!1, %!2, 1, 0);','Stop;')|);
// Convert CR to \\CR
LetRegNum(1, 0);
LetRegNum(2, -3);
Loop(!|>
FindInString("%!0", "$[#13]$", 1,2, 1011, %!2+3);>
IfOK('ReplaceInString("%!0", "\\\\$[#13]$", %!1, %!2, 1,
0);','Stop;')|);
InsText("%!0"); // Insert with no wrapping
End;
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")
ITEM="Paste_tab_to_TeX"
CAPTION="Paste tab to TeX"
MACRO="Exe('%B\Contrib\My\tab_to_tex.edt');" // adapt the path
SHORTCUT="49240::Ctrl+Alt+X"
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.
Gilbert
On 12-Aug-11 9:07, Daniele Giorgio Degiorgi wrote:
>
> Hi,
>
> 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,
>
> Daniel
>
--
--
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
http://mephisto.unige.ch