## Table to TEX

Moderators: EViews Gareth, EViews Moderator, EViews Esther

EViews Esther
EViews Developer
Posts: 149
Joined: Fri Sep 03, 2010 7:57 am

### Table to TEX

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. tchaithonov Posts: 168 Joined: Mon Apr 13, 2009 7:39 am Location: New York City ### Re: Table to TEX 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 EViews Gareth Fe ddaethom, fe welon, fe amcangyfrifon Posts: 11252 Joined: Tue Sep 16, 2008 5:38 pm ### Re: Table to TEX 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 Esther EViews Developer Posts: 149 Joined: Fri Sep 03, 2010 7:57 am ### Re: Table to TEX The install program is updated. maxchen Posts: 191 Joined: Fri Oct 10, 2008 4:03 pm ### Re: Table to TEX 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 %wfequation eq00.qreg y c xfreeze(tb0) eq00.outputtb0.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 "\&" EViews Esther EViews Developer Posts: 149 Joined: Fri Sep 03, 2010 7:57 am ### Re: Table to TEX 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.

dagfinnrime
Posts: 46
Joined: Sat Oct 11, 2008 9:37 am
Location: Oslo
Contact:

### Re: Table to TEX

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

EViews Esther
EViews Developer
Posts: 149
Joined: Fri Sep 03, 2010 7:57 am

### Re: Table to TEX

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... maxchen Posts: 191 Joined: Fri Oct 10, 2008 4:03 pm ### Re: Table to TEX it seems that the download page http://www.eviews.com/Addins/addins.shtml has not been updated for this addin EViews Gareth Fe ddaethom, fe welon, fe amcangyfrifon Posts: 11252 Joined: Tue Sep 16, 2008 5:38 pm ### Re: Table to TEX What do you mean? Follow us on Twitter @IHSEViews CharlieEVIEWS Posts: 202 Joined: Tue Jul 17, 2012 9:47 am ### Re: Table to TEX 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 ? anyway, huge fan of the add-ins guys, keep up the great work. tzink Posts: 28 Joined: Mon Oct 29, 2012 4:55 pm ### Re: Table to TEX 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.

CharlieEVIEWS
Posts: 202
Joined: Tue Jul 17, 2012 9:47 am

### Re: Table to TEX

Dear all,

Really looking forward to more LaTeX integration in EViews 9. However, I think there is a problem with the add-in. When I Proc --> add-in from a table object in EViews 8, Nov 13 2013 build, only the following is generated:

Code: Select all

\documentclass[12pt]{article}\begin{document}\begin{table}\centering\begin{tabular}{}\hline \hline\hline \hline\end{tabular}\end{table}\end{document}

Which doesn't generate any table... Does anybody have any suggestions or ideas? Warmest wishes as always, and again, thanks for all of your hard work on such a great product.

Charlie

basile
Posts: 1
Joined: Tue Dec 10, 2013 10:26 am

### Re: Table to TEX

Hello everyone,

I am a new user of eviews and I'm struggling to get tables in latex format... I downloaded the add in thing, but I have no idea how to generate table afterwards. So starting from a simple regression output window, can someone tell me how to get the latex table ?
Sorry for the stupid question
merry christmas everyone