6

The latex package fixltx2e conflicts with float and prevents using the option H for floats. This can be solved in LaTeX if fixltx2e is loaded prior to float.
However, this doesn't work in Lyx, and an error: ! LaTeX Error: Unknown float option 'H'. is produced.

Any workarounds?

Update: minimal examples
The following code fails to run in LaTeX

\documentclass{article}
\usepackage{float}
\usepackage{fixltx2e}

\begin{document}
\begin{figure}[H]
 Figure placeholder
\end{figure}
\end{document}

But reversing the order of float and fixltx2e fixes the error.

In Lyx, however, this workaround fails:

#LyX 2.1 created this file. For more info see http://www.lyx.org/
\lyxformat 474
\begin_document
\begin_header
\textclass article
\begin_preamble
\usepackage{fixltx2e}
\usepackage{float}
\end_preamble
\use_default_options true
\maintain_unincluded_children false
\language british
\language_package default
\inputencoding auto
\fontencoding global
\font_roman default
\font_sans default
\font_typewriter default
\font_math auto
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100
\font_tt_scale 100
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize 11
\spacing single
\use_hyperref false
\pdf_title "16S General Archaea Primers 109f-934r"
\pdf_author "Roey Angel "
\pdf_bookmarks true
\pdf_bookmarksnumbered false
\pdf_bookmarksopen false
\pdf_bookmarksopenlevel 1
\pdf_breaklinks true
\pdf_pdfborder true
\pdf_colorlinks true
\pdf_backref false
\pdf_pdfusetitle true
\papersize a4paper
\use_geometry false
\use_package amsmath 1
\use_package amssymb 2
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 2
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plainnat
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date true
\justification true
\use_refstyle 1
\index Index
\shortcut idx
\color #008000
\end_index
\leftmargin 1.5cm
\topmargin 1.4cm
\rightmargin 1.5cm
\bottommargin 1.4cm
\secnumdepth 2
\tocdepth 2
\paragraph_separation skip
\defskip smallskip
\quotes_language english
\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
\html_latex_start <span class='latex'>
\html_latex_end </span>
\end_header

\begin_body

\begin_layout Standard

\end_layout

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

\begin_layout Plain Layout
test
\end_layout

\end_inset


\end_layout

\end_body
\end_document
Roey Angel
  • 1,699
  • Can you please post a minimal example .lyx file? See, e.g. http://wiki.lyx.org/FAQ/MinimalExample – scottkosty Oct 03 '14 at 17:07
  • It should work in Lyx too, so probably float is loaded somewhere earlier then you think. Can you load fixltx2e before \documentclass with \RequirePackage{fixltx2e} in Lyx? – Ulrike Fischer Oct 03 '14 at 17:07
  • @UlrikeFischer No that's not currently possible in LyX. – scottkosty Oct 03 '14 at 23:30
  • The best solution is to stop using LyX. Seriously though, I can't generate the conflict you describe; I can load float and fixltx2e in either order and there is no problem. Something else must be going on. – Ian Thompson Oct 04 '14 at 11:02
  • @IanThompson strange. Do you have the latest versions? – Roey Angel Oct 04 '14 at 12:59
  • @scottkosty I added a minimal example. – Roey Angel Oct 04 '14 at 13:00
  • @scottkosty That's a problem as fixltx2e is really not intended to be loaded after \documentclass: it's fixed for the format itself so should be loaded absolutely first. – Joseph Wright Oct 04 '14 at 13:00
  • 1
    @JosephWright Really? That's not what the documentation says - it says that fix-cm should be added before \documentclass with \RequirePackage, but fixltx2e should be added to the preamble with \usepackage – Torbjørn T. Oct 04 '14 at 13:41
  • @RoeyAngel --- Updating to TexLive 2014 enabled me to reproduce (and fix) the problem. See answer below. – Ian Thompson Oct 04 '14 at 14:59
  • @JosephWright I agree. I think it is a missing feature in LyX. – scottkosty Oct 04 '14 at 16:34
  • Thanks for the minimal example. But it works for me without error (and without changing anything) on LyX 2.1.0 and LyX 2.2dev. Also, if you want me to see that you updated something or are responding to a comment of mine, you must notify me with the @ and with my username. Otherwise I will often forget to check back. – scottkosty Oct 04 '14 at 21:11

1 Answers1

3

This is caused by a new feature added to the latest version of the fixltx2e package. (Check the optional arguments of floats, section 5.1 of the package documentation.) I don't know how much freedom you have in LyX, but a standard LaTeX hackaround would be the following.

\documentclass{article}
\usepackage{float}
\makeatletter
\let\@tmp\@xfloat     
\usepackage{fixltx2e}
\let\@xfloat\@tmp                    
\makeatother

\begin{document}
\begin{figure}[H]
 Figure placeholder
\end{figure}
\end{document}

Failing this, make a copy of fixltx2e.sty and delete the redefinition of \@xfloat on lines 488-552. Put this in the same directory as your document so that it takes precedence over the original version.

Ian Thompson
  • 43,767