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

  • 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? – Jasper Habicht Nov 11 '21 at 13:36
  • Indeed, a minimal example .lyx file would really help. Please read here: https://wiki.lyx.org/FAQ/MinimalExample – scottkosty Nov 11 '21 at 13:53
  • Hopefully MWE provided in edited answer helps: thanks! – David Zentler-Munro Nov 11 '21 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 Nov 11 '21 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: https://tex.meta.stackexchange.com/questions/4488/lyx-user-questions-on-tex-stackexchange – David Zentler-Munro Nov 11 '21 at 18:08
  • @DavidZentler-Munro please see the section on that link "How do I post a .lyx file on a forum or a Q&A post without attachments (e.g., tex.stackexchange.com)?". – scottkosty Nov 11 '21 at 18:54
  • @scottkosty thanks: hopefully that format works – David Zentler-Munro Nov 11 '21 at 19:28
  • Thanks for doing that, but this does not appear to be minimal to me. The LaTeX preamble is quite complicated, and even your MWE.tex seems like it could be more simple to show the problem you're running into. I don't know enough LaTeX to disentangle your example file and try to figure out the problem. But I can confirm that I get the same error that you get. I wonder if your colleagues have an older TeX distribution with which it compiles for some reason? – scottkosty Nov 11 '21 at 22:10
  • Simplified MWE.tex and preamble though note that LyX auto adds a lot of the preamble that is not manually specified. On further examination, it seems to be the \toprule, \bottomrule and \addlinespace commands that it doesn't like. Will google to see how to sort this. – David Zentler-Munro Nov 12 '21 at 12:54
  • Answer found here: https://tex.stackexchange.com/questions/611786/misplaced-noalign-because-input-before-booktabs-rule – David Zentler-Munro Nov 12 '21 at 14:32
  • Great! I suggest that you add (and accept) an answer to this question. Try to make it LyX-friendly, e.g., "You just need to add the following code to Document > Settings > LaTeX Preamble: ..." – scottkosty Nov 12 '21 at 14:47

0 Answers0