# Lyx Table has unwanted extra column (in an additional row) with APA

I am encountering this strange problem in LyX when my table ends up having additional "legs" as seen in the figure below.

The document class article apa, doc is what seems to be causing the problem. If I copy and paste the table including the float to a new document with a different document class (article), it works fine.

Anyone else has encountered this issue and know a fix?

Thanks for the prompt response and help. Based on Werner's comments, I tried out adding the following in preamble but resulted in several compilation issues. I am using captions and apa doc.

The second recommendation, adding \makeatletter\let\BBAB\normal@BBAB\makeatother as ERT right before the caption still results in .

I even modified the apa6.cls commenting out the problematic line but it still dodn't fix it. Adding the suggested ERT within the caption leads to undefined control sequence hence it has to be outside. Suggestions?

• As far as I remember Lyx you can delete any row of a given tabular. Did you try that? – Keks Dose Mar 7 '14 at 18:02
• Keke, it is not an additional row; it's a phantom row. – Adnan Masood Mar 8 '14 at 15:25

The apa document class redefines the tabular environment, ending it in the wrong way. Here's the ending definition

\def\endtabular{%
\let\BBAB\normal@BBAB%                        -- thp 2005/07/23
\orig@endtabular\ifapamodedoc{\hfill}{}}% 2006/01/02 \hfill for centering in doc mode


The \let definition before \orig@endtabular is considered an entry in the cell (non-empty), which causes your "legs". If you include in your Document > Settings... > LaTeX Preamble the following (that just comments out the \let), the "legs" disappear. I'm not sure about any other consequences:

\makeatletter
\def\endtabular{%
%\let\BBAB\normal@BBAB%                        -- thp 2005/07/23
\orig@endtabular\ifapamodedoc{\hfill}{}}% 2006/01/02 \hfill for centering in doc mode
\makeatother

• Incredible. How did you find out that? – Keks Dose Mar 7 '14 at 18:19
• Thanks for the prompt response. Unfortunately adding this preamble lead to more issues. This is the relevant section } l.146 \makeatother I suspect you have forgotten a }', causing me to read past where you wanted me to stop. I'll try to recover; but if the error is serious, you'd better type E' or X' now and fix your file. ) Runaway definition? \subcaption #1#2#3->\ifx \relax #2\relax \else \bgroup \let \label =\@\ETC. ! File ended while scanning definition of \sf. <inserted text> } ! ==> Fatal error occurred, no output PDF file produced! – Adnan Masood Mar 7 '14 at 18:26
• @AdnanMasood: So it seems you're using tables with subcaptions? That hadn't occurred to me, since it works fine for the example you show (a standalone table with a caption). Could you include a construction (and perhaps the LaTeX code) associated with your problem table? – Werner Mar 7 '14 at 18:37
• @AdnanMasood: I realise now that you're using a citation in the caption. Perhaps add an ERT just before the caption with the following content: \makeatletter\let\BBAB\normal@BBAB\makeatother`. Is this a one-time use of a citation in the caption, or do you use it more frequently? What about citations inside tables? – Werner Mar 7 '14 at 21:25
• It seems that there's a bug (ending tabular in the wrong way) in the apa document class. Did you file a bug report or contact the maintainer? If the bug report can be linked to, can you please put it here? – scottkosty Mar 8 '14 at 5:07