2

I'm using the following TeX code in LyX for creating a double table. When viewing it in .pdf I don't know why the caption "Main Title" appears below the text Panel A: Effect. Definitely it should be the contrary. Do you know why and how should I fix these issue? Thank you!

%%%%%%%%%%%%%%%%%%%%%%
%% LyX 2.0.7 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[10pt,spanish]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{geometry}
\geometry{verbose,tmargin=2.5cm,bmargin=2.5cm,lmargin=2.5cm,rmargin=2.5cm}
\setlength{\parskip}{\medskipamount}
\setlength{\parindent}{0pt}
\usepackage{setspace}
\onehalfspacing

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
% Packages for tables
\usepackage{booktabs}% Pretty tables
\usepackage{threeparttablex}% For Notes below table

% *****************************************************************
% siunitx
% *****************************************************************
\newcommand{\sym}[1]{\rlap{#1}} % Thanks to Joseph Wright & David Carlisle

\usepackage{siunitx}
\sisetup{
detect-mode,
group-digits = false,
input-symbols = ( ) [ ] - +,
table-align-text-post = false,
input-signs = ,
}

% Character substitution that prints brackets and the minus symbol in text mode. Thanks to David Carlisle
\def\yyy{%
\bgroup\uccode`\~\expandafter`\string-%
\uppercase{\egroup\edef~{\noexpand\text{\llap{\textendash}\relax}}}%
\mathcode\expandafter`\string-"8000 }

\def\xxxl#1{%
\bgroup\uccode`\~\expandafter`\string#1%
\uppercase{\egroup\edef~{\noexpand\text{\noexpand\llap{\string#1}}}}%
\mathcode\expandafter`\string#1"8000 }

\def\xxxr#1{%
\bgroup\uccode`\~\expandafter`\string#1%
\uppercase{\egroup\edef~{\noexpand\text{\noexpand\rlap{\string#1}}}}%
\mathcode\expandafter`\string#1"8000 }

\def\textsymbols{\xxxl[\xxxr]\xxxl(\xxxr)\yyy}


% *****************************************************************
% Estout related things
% *****************************************************************
\let\estinput=\input % define a new input command so that we can still flatten the document

\newcommand{\estwide}[3]{
\vspace{.75ex}{
\textsymbols% Note the added command here
\begin{tabular*}
{\textwidth}{@{\hskip\tabcolsep\extracolsep\fill}l*{#2}{#3}}
\toprule
\estinput{#1}
\bottomrule
\addlinespace[.75ex]
\end{tabular*}
}
}

\newcommand{\estauto}[3]{
\vspace{.75ex}{
\textsymbols% Note the added command here
\begin{tabular}{l*{#2}{#3}}
\toprule
\estinput{#1}
\bottomrule
\addlinespace[.75ex]
\end{tabular}
}
}

% Allow line breaks with \\ in specialcells
\newcommand{\specialcell}[2][c]{%
\begin{tabular}[#1]{@{}c@{}}#2\end{tabular}
}

% *****************************************************************
% Custom subcaptions
% *****************************************************************
% Note/Source/Text after Tables
% The new approach using threeparttables to generate notes that are the exact width of the table.
\newcommand{\Figtext}[1]{%
\begin{tablenotes}[para,flushleft]
\hspace{6pt}
\hangindent=1.75em
#1
\end{tablenotes}
}
\newcommand{\Fignote}[1]{\Figtext{\emph{Note:~}~#1}}
\newcommand{\Figsource}[1]{\Figtext{\emph{Source:~}~#1}}
\newcommand{\Starnote}{\Figtext{\textit{* p < 0.1, ** p < 0.05, *** p < 0.01.}\\ Errores est\'andares corregidos por correlaci\'on y heteroskedasticidad a nivel de escuela entre par\'entesis.}}% Add significance note with \starnote

\makeatother

\usepackage{babel}
\addto\shorthandsspanish{\spanishdeactivate{~<>}}

\begin{document}
$ $ %esto evita el error 
\begin{table}[htbp]
\begin{threeparttable} 
\caption{My Title}
\label{efectos_generales}
\Figtext{\textbf{Panel A: Efecto estudiante en corto plazo}}        \estwide{output/raw_tables/regressions_general2.tex}{3}{c}  
\Figtext{\textbf{Panel B: Efecto estudiante en mediano plazo}}  \estwide{output/raw_tables/regressions_general2_1.tex}{3}{c}       
\Figtext{\footnotesize{Panel A - Controles: (2)}}  
\Figtext{\footnotesize{Panel B - Controles: (3)}}  
\Figtext{\footnotesize{Errores est\'andares corregidos por correlaci\'on y heteroskedasticidad a nivel de escuela entre par\'entesis.\\ \textit{* p < 0.1, ** p < 0.05, *** p < 0.01.}}} 
\end{threeparttable}
\end{table}
\end{document}
11
  • How is \Figtext defined? Can you create a minimal document showing the problem, and edit your question to include either the .lyx file, or at least the exported LaTeX file? Mar 27, 2014 at 23:24
  • Here goes the exported LaTeX file (actually I'm using two files but they are exactly the same except numbers:
    – user46589
    Mar 28, 2014 at 13:52
  • &\multicolumn{3}{c}{Dependent variable} \\\cmidrule(lr){2-4} &\multicolumn{1}{c}{(1)} &\multicolumn{1}{c}{(2)} &\multicolumn{1}{c}{(3)} \\ \midrule Treatment & -0.07 & -0.04 & 0.00 \\ & (0.07) & (0.05) & (0.03) \\ \addlinespace Control & No & Sí & Sí \\ \midrule Obs & 2445 & 2445 & 2416 \\
    – user46589
    Mar 28, 2014 at 13:55
  • Not really, that is just a small snippet of table code, so not very helpful. I meant the file you get if you do File --> Export --> LaTeX (pdflatex) in LyX. As that will contain your entire document, make a copy of your original file, remove everything except the troublesome table, and then export. Edit your question to include this. Mar 28, 2014 at 15:28
  • Ok great, got it. How can I include my pdf file in my question?
    – user46589
    Mar 28, 2014 at 16:10

1 Answer 1

1

The reason is I think 'that is just how threeparttable works'.

The simplest way of fixing this is to place the caption before the threeparttable environment, so you have

\begin{table}[htbp]
\caption{My Title}
\label{efectos_generales}
\begin{threeparttable}
...
\end{threeparttable}
\end{table}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .