0

I'm trying to import a tex table (with estauto) using LyX (2.3.6.2) for Mac (OS Big Sur 11.6). Other colleagues can run the Lyx file fine but I get an error: Misplaced \noalign. From googling, this seems to be a generic bug in latest version of Lyx related to importing child tex tables but I can't see any proposed fixes. Note the table appears fine if I import it in a latex doc.

Copy and Paste from LyX (via TextEdit):

#LyX 2.3 created this file. For more info see http://www.lyx.org/
\lyxformat 544
\begin_document
\begin_header
\save_transient_properties true
\origin unavailable
\textclass article
\begin_preamble

%% TABLES %%
% Packages for tables
\usepackage{booktabs}% Pretty tables
\usepackage{tabularx}


% *****************************************************************
% 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             = ,
        }   


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


\newcommand{\estauto}[3]{
  \small{
        \vspace{-1ex}{
            \begin{tabular}{l*{#2}{#3}}
            \toprule
            \estinput{#1}
            \bottomrule
            \addlinespace[.75ex]
            \end{tabular}
            }
        }
  }
\end_preamble
\use_default_options true
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman "default" "default"
\font_sans "default" "default"
\font_typewriter "default" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\use_microtype false
\use_dash_ligatures true
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry false
\use_package amsmath 0
\use_package amssymb 0
\use_package cancel 0
\use_package esint 0
\use_package mathdots 0
\use_package mathtools 0
\use_package mhchem 0
\use_package stackrel 0
\use_package stmaryrd 0
\use_package undertilde 0
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 1
\use_minted 0
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\is_math_indent 0
\math_numbering_side default
\quotes_style english
\dynamic_quotes 0
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header

\begin_body

\begin_layout Standard
\begin_inset Float table
placement H
wide false
sideways false
status open

\begin_layout Plain Layout
\begin_inset Caption Standard

\begin_layout Plain Layout
MWE Table 
\begin_inset CommandInset label
LatexCommand label
name "MWE"

\end_inset


\end_layout

\end_inset


\end_layout

\begin_layout Plain Layout
\begin_inset ERT
status open

\begin_layout Plain Layout


\backslash
centering
\end_layout

\begin_layout Plain Layout


\backslash
small{
\end_layout

\begin_layout Plain Layout


\backslash
estauto{/tables/MWE.tex}{3}{c}
\end_layout

\begin_layout Plain Layout

}
\end_layout

\begin_layout Plain Layout

\end_layout

\end_inset


\end_layout

\end_inset


\end_layout

\begin_layout Standard

\end_layout

\end_body
\end_document

Tex code for MWE.tex

11 & 12 & 13 \\
21 & 22 & 23 \\
31 & 32 & 33 \\

** Edit, now found answer: Misplaced \noalign because \input before booktabs rule

11
  • 1
    Welcome to TeX.SX! It is very hard without having any code to guess what might be wrong here. Would you mind posting the code of such a table or at least something so that we can try to reproduce your problem? Commented Nov 11, 2021 at 13:36
  • Indeed, a minimal example .lyx file would really help. Please read here: wiki.lyx.org/FAQ/MinimalExample
    – scottkosty
    Commented Nov 11, 2021 at 13:53
  • Hopefully MWE provided in edited answer helps: thanks! Commented Nov 11, 2021 at 14:24
  • @DavidZentler-Munro thanks for adding those. Please read the link that I gave to understand how to add a minimal example .lyx file.
    – scottkosty
    Commented Nov 11, 2021 at 15:45
  • @scottkosty I believe it is not possible to attach a file, so I simply copy and pasted the code preview of the lyx file, the preamble and the tex file. Let me know if you need anything else. This is the copy paste strategy advised here: tex.meta.stackexchange.com/questions/4488/… Commented Nov 11, 2021 at 18:08

0

You must log in to answer this question.

Browse other questions tagged .