Text FormattingImporting (formatted) text

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
salehin
Posts: 34
Joined: Wed Jun 10, 2009 1:29 am

Importing (formatted) text

Post by salehin »

Hello everyone

I'm trying to import regression results from EViews 7. However, even after using verbatim environment, the results doesn't look as it does when I do it from Stata. I simply copy and paste them in LaTeX and then use verbatim. I think probably because EVIEWS does some formatting before posting the results.

I've also attached an image file of the output from Eviews7. Ideally speaking I want the that format with verbatim. If that is not possible, at least that format.

Thanks for reading. :)

MWE follows:

Code: Select all

\documentclass[a4paper,12pt, final]{article}%
\usepackage[margin=2.54cm,top=2.54cm]{geometry}
\usepackage{hyperref}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{verbatim}
\usepackage{graphicx}
\usepackage[gen]{eurosym}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{epstopdf}

\usepackage{fancyhdr}
\usepackage{lmodern}

\pagestyle{fancy}
\lhead{\thepage}
\fancyfoot{}
\renewcommand{\headrulewidth}{0pt}

\begin{document}

\title{my}
\author{it's me}
\maketitle

\section{Regression tables}

\label{results}

\subsection{Regression 1}

\begin{small}
\begin{verbatim}
Null Hypothesis: DLCONS has a unit root				
Exogenous: Constant, Linear Trend				
Lag Length: 0 (Automatic - based on SIC, maxlag=12)				
				
			t-Statistic	  Prob.*
				
Augmented Dickey-Fuller test statistic			-8.740457	 0.0000
Test critical values:	1% level		-4.027463	
	5% level		-3.443450	
	10% level		-3.146455	
				
*MacKinnon (1996) one-sided p-values.				
				
				
Augmented Dickey-Fuller Test Equation				
Dependent Variable: D(DLCONS)				
Method: Least Squares				
Date: 12/03/10   Time: 22:24				
Sample (adjusted): 1960Q3 1994Q1				
Included observations: 135 after adjustments				
				
Variable	Coefficient	Std. Error	t-Statistic	Prob.
				
DLCONS(-1)	-0.734338	0.084016	-8.740457	0.0000
C	0.005347	0.001349	3.962918	0.0001
@TREND(1960Q1)	-1.91E-05	1.52E-05	-1.260037	0.2099
				
R-squared	0.366805	    Mean dependent var		-2.03E-05
Adjusted R-squared	0.357211	    S.D. dependent var		0.008444
S.E. of regression	0.006770	    Akaike info criterion		-7.130654
Sum squared resid	0.006050	    Schwarz criterion		-7.066092
Log likelihood	484.3191	    Hannan-Quinn criter.		-7.104418
F-statistic	38.23334	    Durbin-Watson stat		1.952455
Prob(F-statistic)	0.000000			

\end{verbatim}
\end{small}



\end{document} 
Attachments
regr_import.JPG
regr_import.JPG (55.08 KiB) Viewed 6523 times
Last edited by salehin on Fri Dec 10, 2010 1:36 am, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Importing (formatted) text

Post by localghost »

This content belongs in a tabular environment, perhaps tweaked with booktabs. That will require some additions to the code.


Thorsten
salehin
Posts: 34
Joined: Wed Jun 10, 2009 1:29 am

Re: Importing (formatted) text

Post by salehin »

Thanks for the tip, Thorsten.

I've read through the tabular & booktabs instructions and it seems that I need do it manually. Am I correct? I was wondering if it's possible to do it automatically.

I'll use the tick icon once it's sorted. :)

Regards
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Importing (formatted) text

Post by localghost »

salehin wrote:[…] I've read through the tabular & booktabs instructions and it seems that I need do it manually. Am I correct? I was wondering if it's possible to do it automatically. […]
Unless you are good at scripting (e. g. Perl) I'm afraid that this will be a manual task for you.
salehin
Posts: 34
Joined: Wed Jun 10, 2009 1:29 am

Importing (formatted) text

Post by salehin »

Problem solved:
- There is an option of saving the results from EViews to a normal text file.
- Then we copy and paste the entire content from the .txt file to .tex using verbatim environment. For e.g.,

Code: Select all

\begin{small} % for small fonts
\begin{verbatim}
Copy and paste the text from the .txt file
\end{verbatim}
\end{small}
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Importing (formatted) text

Post by localghost »

I would have done this like shown below.

Code: Select all

\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage[includeheadfoot,margin=2cm]{geometry}
\usepackage[font=small,labelfont=bf,tableposition=top]{caption}
\usepackage{booktabs,dcolumn,threeparttable}

\newcolumntype{d}[1]{D{.}{.}{#1}}

\begin{document}
  \begin{table}[!ht]
    \caption{Table caption}\label{tab:table-1}
    \centering\ttfamily
    \begin{threeparttable}
      \begin{tabular}{llcc}\toprule
        \multicolumn{2}{l}{Null Hypothesis: DLCONS has a unit root} & & \\
        \multicolumn{2}{l}{Exogenous: Constant, Linear Trend} & & \\
        \multicolumn{2}{l}{Lag Length: 0 (Automatic - based on SIC, maxlag=12)} & & \\ \midrule
        & & t-Statistic & Prob.\tnote{*} \\ \midrule
        \multicolumn{2}{l}{Augmented Dickey-Fuller test statistic} & -8.740457 & 0.0000 \\ \midrule
        Test critical values: & \makebox[1em][r]{1}\% level  & -4.027463 & \\
                              & \makebox[1em][r]{5}\% level  & -3.443450 & \\
                              & \makebox[1em][r]{10}\% level & -3.146455 & \\ \bottomrule
      \end{tabular}
      \begin{tablenotes}
        \footnotesize
        \item[*] MacKinnon (1996) one-sided p-values.
      \end{tablenotes}
    \end{threeparttable}
  \end{table}

  \begin{table}[!ht]
    \caption{Table caption}\label{tab:table-2}
    \centering\ttfamily
    \begin{tabular}{lcccc}
      \multicolumn{3}{l}{Augmented Dickey-Fuller Test Equation} & & \\
      \multicolumn{3}{l}{Dependent Variable: D(DLCONS)} & & \\
      \multicolumn{3}{l}{Method: Least Squares} & & \\
      \multicolumn{3}{l}{Date: 12/03/10   Time: 22:24} & & \\
      \multicolumn{3}{l}{Sample (adjusted): 1960Q3 1994Q1} & & \\
      \multicolumn{3}{l}{Included observations: 135 after adjustments} & & \\ \midrule
      \multicolumn{1}{c}{Variable} & Coefficient & Std. Error & t-Statistic & Prob. \\ \midrule
      \multicolumn{1}{c}{DLCONS(-1)} & -0.734338 & 0.084016 & -8.740457 & 0.0000 \\
      \multicolumn{1}{c}{C} & 0.005347 & 0.001349 & 3.962918 & 0.0001 \\
      \multicolumn{1}{c}{@TREND(1960Q1)} & -1.91E-05 & 1.52E-05 & -1.260037 & 0.2099 \\ \midrule
      R-squared & 0.366805 & \multicolumn{2}{l}{Mean dependent var} & -2.03E-05 \\
      Adjusted R-squared & 0.357211 & \multicolumn{2}{l}{S.D. dependent var} & 0.008444 \\
      S.E. of regression & 0.006770 & \multicolumn{2}{l}{Akaike info criterion} & -7.130654 \\
      Sum squared resid & 0.006050 & \multicolumn{2}{l}{Schwarz criterion} & -7.066092 \\
      Log likelihood & 484.3191 & \multicolumn{2}{l}{Hannan-Quinn criter.} & -7.104418 \\
      F-statistic & 38.23334 & \multicolumn{2}{l}{Durbin-Watson stat} & 1.952455 \\
      Prob(F-statistic) & & & & 0.000000 \\ \bottomrule
    \end{tabular}
  \end{table}
\end{document}
salehin
Posts: 34
Joined: Wed Jun 10, 2009 1:29 am

Importing (formatted) text

Post by salehin »

Hi LGH.

Thanks for your post...I'm away from internet, so I'll write back about it later aftre trying it. In the mean time, I need some help. In case, yours suggestion is what I'm looking for I apologise.

I need some help. After contacting the Eviews stuffs, they kindly came up with a plug-ins that exports full outputs in LaTeX format. However, it is only useful in Landscape mode. But I'd like to have it in portrait mode.

Alternatively, can you please let me know how to insert the whole table in landscape format with other things in portraint format.

I'd really appreciate if you can kindly tweak the attached .TeX file, so that I can see examples of both options (mentioned above) and follow from there.

Regards

S

Code: Select all

\documentclass[12pt]{article}
\begin{document}
\begin{table}
\centering
\begin{tabular}{l |l |l |l |l}
\hline \hline
Dependent Variable: LNF&
&
&
&
\\
Method: Dynamic Least Squares (DOLS)&
&
&
&
\\
Date: 12/18/10   Time: 19:50&
&
&
&
\\
Sample: 1959 2003&
&
&
&
\\
Included observations: 45&
&
&
&
\\
Cointegrating equation deterministics: C &
&
&
&
\\
Static OLS leads and lags specification&
&
&
&
\\
Long-run variance estimate (Bartlett kernel, Newey-West fixed bandwidth =&
&
&
&
\\
4.0000)&
&
&
&
\\
&
&
&
&
\\
Variable&
Coefficient&
Std. Error&
t-Statistic&
Prob.
\\
&
&
&
&
\\
LNI&
0.500184&
0.014031&
35.64773&
0.0000
\\
LNP&
-0.074681&
0.116274&
-0.642286&
0.5242
\\
C&
2.236158&
0.619467&
3.609811&
0.0008
\\
&
&
&
&
\\
R-squared&
0.992009&
Mean dependent var&
&
6.021331
\\
Adjusted R-squared&
0.991628&
S.D. dependent var&
&
0.222787
\\
S.E. of regression&
0.020384&
Sum squared resid&
&
0.017452
\\
Durbin-Watson stat&
0.478540&
Long-run variance&
&
0.001058
\\
\hline \hline
\end{tabular}
\end{table}
\end{document}
salehin
Posts: 34
Joined: Wed Jun 10, 2009 1:29 am

Re: Importing (formatted) text

Post by salehin »

Hi LGH and others

I had a look at it. I like the way it looks. If you did it automatically , can you please let me know.

Also I'd be grateful if someone can kindly reply to my previous query.

Regards

S
Post Reply