2

I'm importing tables from stata into LaTeX, by using \import{C:/Users/.../filename.tex. This works completly fine, however, since I have some tables that don't fit on the page I want to adjust the fontsize for all tables. I've tried to wrap the tables in tabular and tried various different packages, but so far nothing helped my. So I would really appriciate it if you know how to adjust the fontsize of the table, or maybe scale them.

I've read this question which is similar, but I couldn't find an awnser without adjusting anything in the input file.

My code so far looks like this: Main document:

\documentclass[12pt]{article}
\usepackage{booktabs}
\begin{document}
...
\input{C:/Users/.../PrePostCrisisSector.tex}
...
\end{document}

Input file:

\begin{table}[htbp]\centering
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\caption{Sector return pre- and post crisis\label{PrePostSCrisis}}
\begin{tabular}{l*{1}{{r}{r}{r}{r}{r}{r}{r}{r}}}
\toprule
                    &PreCrisisSREITs&PreSCrisisReturn&PreSCrisisSD&PreSCrisisSharpe&PostCrisisSREITs&PostSCrisisReturn&PostSCrisisSD&PostSCrisisSharpe\\
\midrule
Diversified         &          58&        1.15&     14.0868&      0.0817&            &      2.1087&     14.3411&      0.1470\\
Health Care         &          77&        3.65&     11.0185&      0.3315&            &      2.8137&     12.0343&      0.2338\\
Hotel               &          70&       -0.06&     13.9054&     -0.0045&            &      1.3071&     18.5116&      0.0706\\
Industrial          &          49&        1.15&     11.1171&      0.1035&            &      2.9184&     13.7818&      0.2118\\
Manufactured Home   &          80&        1.10&      8.7773&      0.1250&            &      5.1106&      9.9770&      0.5122\\
Multifamily         &          74&        1.22&     17.3891&      0.0701&            &      2.9535&     14.2079&      0.2079\\
Office              &          67&        2.06&     12.0812&      0.1708&            &      2.2114&     11.5217&      0.1919\\
Other Retail        &          72&        1.55&     13.3247&      0.1163&            &      2.4823&     11.2678&      0.2203\\
Regional Mall       &          46&        1.09&     14.8050&      0.0739&            &      2.6113&     13.2250&      0.1974\\
Self-Storage        &          80&        2.33&     10.3806&      0.2241&            &      5.0595&     12.5498&      0.4032\\
Shopping Center     &          70&        2.95&     10.5588&      0.2795&            &      2.0632&     13.6709&      0.1509\\
Specialty           &          78&        3.12&      9.0598&      0.3446&            &      2.8542&     15.5647&      0.1834\\
Total               &            &        1.74&     12.6424&      0.1486&            &      2.4443&     13.9503&      0.1815\\
\bottomrule
\end{tabular}
\end{table}
  • Welcome to TeX.SX! Please make your example compilable. – TeXnician Nov 16 '17 at 10:37
  • Sorry, what do you mean? I'm fairly new to all of this. – Sukaldi Nov 16 '17 at 11:13
  • That means that you should not include/input any files, but just c&p it into your main file and add all required packages to compile. – TeXnician Nov 16 '17 at 16:21
1

I'd reconsider if you really want that table included without changing anything. I had to remove all margins and set font size to tiny to get it on the page at all!

Also, adjusting margins for one table without changing the table definition is going to be a challenge, I guess.

\documentclass[12pt]{article}
\usepackage{booktabs}

\usepackage{geometry}

% From https://tex.stackexchange.com/a/27100/98850
\usepackage{floatrow}
\DeclareFloatFont{tiny}{\tiny}% "scriptsize" is defined by floatrow, "tiny" not
\floatsetup[table]{font=tiny}

\addtolength{\oddsidemargin}{-1.2in}
\addtolength{\evensidemargin}{-1.2in}
\addtolength{\textwidth}{1.75in}

\begin{document}
        \input{PrePostCrisisSector}
\end{document}

enter image description here

  • Thank you very much! I'm not sure whether I understand you correctly, but I don't mind changing the table definition as long as that doesn't imply adjusting code in the input file. – Sukaldi Nov 20 '17 at 8:25
  • @Sukaldi Now I am the one to be confused, your table definition is in the input file right? :) – PHPirate Nov 20 '17 at 8:26
  • I thought that table definition was specified in the preamble by the booktabs package or some similar package. But apparently it means the \begin{table} part so to say. In that case, no, I don't want to adjust the table definition. – Sukaldi Nov 20 '17 at 9:48
  • Aha yeah that was were the confusion came from :) In general it's tough to undo layout options (in this case the environments used) specified in a file which you can't change, because usually you overrule general layout options defined in the preamble, not the other way around. If you generate latex I would definitely look for options on the generating side. (Not sure if you know, if you think any answer good enough you can mark it as 'accepted' by clicking the green checkmark next to it.) – PHPirate Nov 20 '17 at 16:39
  • Thanks for your help! Since I ran my Stata code over and over to check my tables, it undoes all the changes in the table definition. However, I now just copy the exported Stata file to a different folder and use that in my latex file. Thus now i'm able to adjust the definition. – Sukaldi Nov 28 '17 at 13:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.