2

Using LyX with the linguistics module. I want to have a table as a Numbered Example. When I insert a table float after the example, the number appears after the table on the PDF, rather than before it.

Edit: Floats are set to appear "here definitely", but the problem persists.

The .lyx file relevant section:

\begin_body

\begin_layout Numbered Example (multiline)
\begin_inset Float table
wide false
sideways false
status open
\begin_layout Plain Layout
\begin_inset Tabular
<lyxtabular version="3" rows="1" columns="1">
<features tabularvalignment="middle">
<column alignment="center" valignment="top" width="0">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text

\begin_layout Plain Layout
a
\end_layout

\end_inset
</cell>
</row>
</lyxtabular>

\end_inset


\end_layout

\end_inset


\end_layout

\end_body
\end_document
  • 1
    I cannot reproduce the problem, with a table float within a numbered example, the table appears after the example number when set to here definetely. Can you trim your document down to the minimum showing the problem, and edit your question to include the contents of the .lyx file (it is just plain text, you can open it in a text editor) or at least the exported LaTeX source? – Torbjørn T. Sep 22 '13 at 12:03
1

This seems only to happen when there is no text before the table float within the example, though exactly why I cannot say. If you don't want any text before the table, a workaround seems to be to insert a \hfill right after the example number. You can do that either by adding an ERT (Ctrl + L) and writing \hfill in it, or by choosing Insert --> Formatting --> Horizontal Space, and selecting Horizontal fill.

However, floats does not seem to respect the indentation in the examples environment. A workaround for this is to not use a float, but a minipage. This does not require any tricks such as \hfill. It does however require writing the caption in an ERT, and you have to set the width of the minipage:

  1. At the start of the Example, do Insert --> Box --> Frameless.
  2. In the settings of this box, set the width to a little less than 100% of the column width, say 98%. The reason is that \columnwidth seems to be a little bit more than full text width minus the indentation, so with 100% the minipage will stick into the margin a little. (This is not ideal, I know, but my best suggestion after fifteen minutes of trying.)
  3. Go to Document --> Settings --> LaTeX preamble and add

    \usepackage{capt-of}
    

    (If you have this or \usepackage{caption} already, then you don't have to do this.)

  4. Inside the minipage, to create a table caption, add an ERT and write

    \captionof{table}{This is your caption.}
    
  • Not a very good answer, I know, but it seemed to do the trick. – Torbjørn T. Sep 22 '13 at 12:26
  • Thanks! This does work (in fact, it seems like adding any element, such a hard-space works), however it also gets rid of the indentation of the table for some reason... – Henry Brice Sep 22 '13 at 12:36
  • @HenryBrice I don't get any indentation with or without the \hfill, do you? I'll update my answer with another workaround that takes care of both problems. – Torbjørn T. Sep 22 '13 at 16:04
  • Thanks, the workaround seems to work perfectly. Thank you very much! – Henry Brice Sep 23 '13 at 14:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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