Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am including a TeX file into a LyX document using Insert -> Child Document. The Table looks fine on the LyX screen but when I preview the PDF it is 10 times too big. Not sure how to fiddle with the magnification to make it look right. Or is using the child document route wrong?

Here is the MWE:

\begin{table}
\caption{Regression table}\label{tab1}
\centering

\smallskip
\begin{tabular}{@{}l cccccc @{}}
\toprule
& \multicolumn{2}{c}{Model 1}
& \multicolumn{2}{c}{Model 2}
& \multicolumn{2}{c@{}}{Model 3}\\
\cmidrule(lr){2-3} \cmidrule(lr){4-5} \cmidrule(l){6-7}
& Coef. & SE & Coef. & SE & Coef. & SE\\
\midrule
Variable 1 & 12.758 & * &  13.822 & *** & 2.123 & *\\
\midrule[\heavyrulewidth]
\multicolumn{7}{@{}l}{* $p < 0.05$, ** $p < 0.01$, *** $p < 0.001$.}\\
\end{tabular}
\end{table}

When I add this as an input to my LyX Beamer presentation the slide magnifies the table 5-10 times making it unreadable.

share|improve this question
    
Welcome to TeX.SX! It should be possible to use a child document. Can you add a minimal working example (MWE) that illustrates your problem? It will be much easier to reproduce your situation. In this case you should reduce the table to the smallest table that still has the problem and then use "View > View Source" to post the LaTeX Source of the child document. Furthermore, do you 'include' or 'input' the child document? –  e-birk Mar 17 '13 at 22:42
    
@e-birk Updated the question, looking forward to some help! –  Chris J Mar 17 '13 at 23:03
    
Your code snippet isn't a true MWE, as it can't be compiled without providing some further code. Moreover, given that you say you're using lyx, is there maybe more setup information you should give out to enable others to replicate the problem you're experiencing? (I don't use lyx at all, so I'm afraid I can't help you.) –  Mico Mar 17 '13 at 23:45
    
@CJ12 I cannot replicate the problem so far. Sorry, I did not mention before, but I meant with the setting "Complete Source" (instead of "Current Paragraph" under "View Source"). If this is not enough to reproduce the problem then also the LaTeX source of the main document shortened as much as possible should be posted (of course, shortening should only be done on a copy of it). Then it will be truely a MWE! –  e-birk Mar 18 '13 at 0:00
    
@e-birk There isn't much more to add. I am using LyX's beamer template and creating a child document with the above code in the tex file. LyX reads it just fine but when I compile the PDF the table is magnified 10-20 times more than is readable. –  Chris J Mar 18 '13 at 6:10
add comment

1 Answer

up vote 2 down vote accepted

Your problem might be hidden in some settings that are not shown at the moment... Hence, the complete generated LaTeX code would be helpful. At least I found some information that was not mentioned before:

  • that you are probably using the package booktabs because of \toprule etc. Hence, you seem to have created the table by inserting TeX code/ERT into your child document.

  • what exact document class your main document and your child document have -- I assume "presentation (beamer)" for both.

Here I give a MWE that works for me as expected. The output is

output of LyX file

The LyX file looks like

lyx file

and here is the generated LaTeX code (very few lines are removed).

%% LyX 2.0.5.1 created this file.  For more info, see http://www.lyx.org/.
\documentclass[english]{beamer}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
% this default might be overridden by plain title style
\newcommand\makebeamertitle{\frame{\maketitle}}%
\AtBeginDocument{
  \let\origtableofcontents=\tableofcontents
  \def\tableofcontents{\@ifnextchar[{\origtableofcontents}{\gobbletableofcontents}}
  \def\gobbletableofcontents#1{\origtableofcontents}
}
\long\def\lyxframe#1{\@lyxframe#1\@lyxframestop}%
\def\@lyxframe{\@ifnextchar<{\@@lyxframe}{\@@lyxframe<*>}}%
\def\@@lyxframe<#1>{\@ifnextchar[{\@@@lyxframe<#1>}{\@@@lyxframe<#1>[]}}
\def\@@@lyxframe<#1>[{\@ifnextchar<{\@@@@@lyxframe<#1>[}{\@@@@lyxframe<#1>[<*>][}}
\def\@@@@@lyxframe<#1>[#2]{\@ifnextchar[{\@@@@lyxframe<#1>[#2]}{\@@@@lyxframe<#1>[#2][]}}
\long\def\@@@@lyxframe<#1>[#2][#3]#4\@lyxframestop#5\lyxframeend{%
  \frame<#1>[#2][#3]{\frametitle{#4}#5}}
\def\lyxframeend{} % In case there is a superfluous frame end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{booktabs}
\makeatother
\usepackage{babel}

\begin{document}
\lyxframeend{}\lyxframe{test slide}

\begin{table}
\caption{Caption of table}
\label{tab1}\centering\begin{tabular}{@{}l cccccc @{}} 
\toprule
&\multicolumn{2}{c}{M1} &\multicolumn{2}{c@{}}{M2} &\multicolumn{2}{c@{}}{M3}\\
\cmidrule(lr){2-3} \cmidrule(lr){4-5} \cmidrule(l){6-7} &C &SE &C &SE &C &SE\\
\midrule
Variable 1 & 12.345 & * &  23.456 & *** & 34.567 & *\\
\midrule[\heavyrulewidth]
\multicolumn{7}{@{}l}{* $p < 0.05$, ** $p < 0.01$, *** $p < 0.001$.}\\
\end{tabular}
\end{table}

\lyxframeend{}
\end{document}
share|improve this answer
    
Your way works, perfect with two quick questions. 1) How did you get the Table 1: Caption of Table to appear in an editable format and how did you put the tab centering? I am adding a float table and copying the code tabular to tabular and it works, but I cannot easily add the title. –  Chris J Mar 18 '13 at 21:15
    
Unfortunately when I add more rows and make the variable names longer the table still needs to be reduced. So the problem is still there, but it is less magnified –  Chris J Mar 18 '13 at 21:21
    
@CJ12 You can insert/edit the title of the table after inserting the float table ("Insert > Float > Table"). At first there is just a small red box after "Table 1:" (or whatever number it is) - the box is for the table title. (Just in case, there is no need for the caption package.) –  e-birk Mar 18 '13 at 21:47
    
@CJ12 To reduce the size of the table you can change the text font size. Click beside the ERT "\centering" on the right side. Use <shift>-<right cursor> to mark only the inner ERT "\begin{tabular} ... \end{tabular}". Then "Edit > Text Style > Customized" and set "Size" to "Small" or "Smaller" or ... "Tiny" to get a smaller text font sizes. Hopefully at least "Tiny" reduces the size enough... –  e-birk Mar 18 '13 at 22:00
    
Great! Thanks!! –  Chris J Mar 19 '13 at 1:38
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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