Table to TEX

For questions about EViews Add-ins available from the EViews Add-ins webpage. Note each add-in available on our webpage will have its own individual thread.

Moderators: EViews Moderator, EViews Gareth, EViews Esther

Table to TEX

Postby EViews Esther on Fri Dec 17, 2010 11:36 am

This thread is about the new version of tbl2tex add-in that converts a EViews table into LaTex-type table.

Please note that fancy styles (e.g. color/symbols/characters) and the line between header and content cannot be created.
However, we would like to actively continue working to better integrate LaTex in EViews.

[Change log]
  • 2011/02/10 Special characters (e.g. # & % $ ~ _ ^ { }) are controlled.
  • 2011/05/24 Additional special character \ (backslash) is controlled.
Last edited by EViews Esther on Thu Feb 10, 2011 11:45 am, edited 1 time in total.
EViews Esther
EViews Developer
 
Posts: 127
Joined: Fri Sep 03, 2010 7:57 am

Re: Table to TEX

Postby tchaithonov on Mon Dec 20, 2010 9:20 am

Hi Esther,

I just took a look at your code and I wonder, since this is only for tables, wouldn't it be better if you make it into a table proc instead of a global one? Besides, it would require users to actually click on the table first before running the program (to get input for the _this command), maybe global is not the best idea. Just a thought.

Tchaithonov
tchaithonov
 
Posts: 165
Joined: Mon Apr 13, 2009 7:39 am
Location: New York City

Re: Table to TEX

Postby EViews Gareth on Mon Dec 20, 2010 9:50 am

Mistake in the installer. It actually works from _this, so yeah it should be a table proc. We'll update the installer.
Follow us on Twitter @IHSEViews
EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
 
Posts: 5786
Joined: Tue Sep 16, 2008 5:38 pm

Re: Table to TEX

Postby EViews Esther on Mon Dec 20, 2010 10:03 am

The install program is updated.
EViews Esther
EViews Developer
 
Posts: 127
Joined: Fri Sep 03, 2010 7:57 am

Re: Table to TEX

Postby maxchen on Wed Feb 09, 2011 7:18 pm

the "&" is not filtered!

for example
Code: Select all
%ex7 = "\Example Files\EV7 Manual Data"
%ch28 = "\Chapter 28 - Quantile Regression"
%wf = @evpath + %ex7 +%ch28 +"\engel.wf1"
wfopen %wf

equation eq00.qreg y c x
freeze(tb0) eq00.output
tb0.tbl2tex(name="tb0",path="e:/")


in the tex file, the line
Code: Select all
Huber Sandwich Standard Errors & Covariance

the character "&" should be changed to "\&"
maxchen
 
Posts: 103
Joined: Fri Oct 10, 2008 4:03 pm

Re: Table to TEX

Postby EViews Esther on Thu Feb 10, 2011 9:44 am

Yes. You are right. Whenever we use one of the following special characters,

# & % $ ~ _ ^ { } \

we need to include a \ in front of the character.

Let me think about how to deal with these special characters.
EViews Esther
EViews Developer
 
Posts: 127
Joined: Fri Sep 03, 2010 7:57 am

Re: Table to TEX

Postby dagfinnrime on Tue May 24, 2011 2:26 am

Hi,

I think the following works.

Replace:
Code: Select all
%special = "# & % $ ~ _ ^ { } \"
for !r=1 to !nrows
   for !c=1 to !ncols
      %temp = {%tbl}(!r,!c)
      for !i=1 to @wcount(%special)
         %cha = @word(%special,!i)
         if @wfind(%temp, %cha) then
            %cha1 = "\"+ %cha
            %temp = @replace(%temp, %cha, %cha1)            
         endif   
      next

with:
Code: Select all
%special = "# & % $ ~ _ ^ { }" '\"
for !r=1 to !nrows
   for !c=1 to !ncols
      %temp = {%tbl}(!r,!c)
      for !i=1 to @wcount(%special)
         %cha = @word(%special,!i)
            %cha1 = "\"+ %cha
            %temp = @replace(%temp, %cha, %cha1)            
      next

Change amounts to dropping "\" from list of special characthers and dropping the if-statement (which seems unnecessary). Maybe the @wfind, which should return position of character, doesn't work (Haven't checked).

About dropping "\". If the code encounters "\" then it would create "\\" which is a linebreak, which is not what you want. I'm not sure you really will use "\" that often that it is a big problem. If you want "\" in the list you have to add a special condition for that character (I think).

Dagfinn
dagfinnrime
 
Posts: 28
Joined: Sat Oct 11, 2008 9:37 am

Re: Table to TEX

Postby EViews Esther on Tue May 24, 2011 8:48 am

dagfinnrime wrote:Change amounts to dropping "\" from list of special characthers and dropping the if-statement (which seems unnecessary). Maybe the @wfind, which should return position of character, doesn't work (Haven't checked).

Yes. @wfind should be replaced to @instr when we want to find the position of characters.
However, as you mentioned, the step to check whether special characters are found can be ignored.

dagfinnrime wrote:About dropping "\". If the code encounters "\" then it would create "\\" which is a linebreak, which is not what you want. I'm not sure you really will use "\" that often that it is a big problem. If you want "\" in the list you have to add a special condition for that character (I think).

We can keep the list for special characters by adding an additional condition - i.e. if %cha = "\" then - as follows.
Code: Select all
%special = "# & % $ _ { } \ ~ ^"
for !r=1 to !nrows
   for !c=1 to !ncols
      %temp = {%tbl}(!r,!c)
      for !i=1 to @wcount(%special)
         %cha = @word(%special,!i)
         if %cha = "\" then
            %temp = @replace(%temp, %cha, "$\backslash$")            
         else
            %temp = @replace(%temp, %cha, "\" + %cha)                        
         endif
      next
...
EViews Esther
EViews Developer
 
Posts: 127
Joined: Fri Sep 03, 2010 7:57 am

Re: Table to TEX

Postby maxchen on Tue Aug 30, 2011 12:25 am

it seems that the download page http://www.eviews.com/Addins/addins.shtml has not been updated for this addin
maxchen
 
Posts: 103
Joined: Fri Oct 10, 2008 4:03 pm

Re: Table to TEX

Postby EViews Gareth on Tue Aug 30, 2011 7:49 am

What do you mean?
Follow us on Twitter @IHSEViews
EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
 
Posts: 5786
Joined: Tue Sep 16, 2008 5:38 pm

Re: Table to TEX

Postby CharlieEVIEWS on Tue Sep 18, 2012 6:23 am

Perhaps I am doing something wrong here (using TeXWorks) but the compiled files look seriously disfigured - either when copied into a larger .tex or when run as the .tex produced directly by the add-in. Also, I am experiencing problems with the $\backslash$_ which occurs when you have an underscore in a variable name.

Any help? I am being a moron :roll: ? anyway, huge fan of the add-ins guys, keep up the great work.
CharlieEVIEWS
 
Posts: 15
Joined: Tue Jul 17, 2012 9:47 am

Re: Table to TEX

Postby tzink on Fri Nov 02, 2012 2:03 pm

The output of this add-in doesn't compile for me. Errors are due to the fact that special characters aren't properly dealt with. For instance, the produced code snippet:

Equation: LN$\backslash$_S$\backslash$_P = P(1) + P(2)*LN$\backslash$_P$\backslash$_CU + P(3)*LN$\backslash$_P$\backslash$_FUEL + P(4) \\

results in the error:
! Missing $

The problem is that the underscores in my variables names are not filtered properly by the $\backslash$ command. I don't know enough about EViews programming to suggest a solution, unfortunately.

Has anyone on the dev team looked at GRETL's implementation? The Latex integration in GRETL is flawless, IMO.
tzink
 
Posts: 21
Joined: Mon Oct 29, 2012 4:55 pm


Return to Add-in Support

Who is online

Users browsing this forum: No registered users and 1 guest