

% this format for review copy
%
% PROBLEM HERE
% LyX import loses the 12pt and onecolumn options
%
\documentclass[conference,12pt,onecolumn,draftcls,]{IEEEtran}


% following is from official template
\usepackage{cite}
\usepackage{amsmath,amssymb,amsfonts}
% use fancy algorithm
% \usepackage{algorithmic}
\usepackage{graphicx}
\usepackage{textcomp}
\usepackage{xcolor}
\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
    T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}
    


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.

%
% we need theorems
\usepackage{amsthm}
% 
% PROBLEM HERE
% 
% if the following are commented out pdflatex has errors
% if they are not commented out LyX view has errors
%
\newtheorem{thm}{Theorem}[section]
\newtheorem{lem}[thm]{Lemma}



% this makes getting the right amount of space much easier
%
\usepackage{xspace}

% I like nicefrac
\usepackage{nicefrac}
%
% we need this package for macros for declaring operators
%
\usepackage{amsopn}



%
% we need multirow tables
%
\usepackage{multirow}
%
% I need to force one enumerate to roman numerals otherwise it clashes with section numbering
\usepackage{enumitem}
%
% tikz pictures
%
\usepackage{float}
% \floatstyle{boxed} 
\restylefloat{figure}
%
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18} % newest at creation time
\usetikzlibrary{decorations.pathmorphing} 

% do I need this macro hack ?
% \makeatother

\usepackage{babel}
\providecommand{\conjecturename}{Conjecture}
\providecommand{\lemmaname}{Lemma}
\providecommand{\remarkname}{Remark}
\providecommand{\theoremname}{Theorem}

\begin{document}
\title{Importing to Lyx Fails}
\author{The Authors}

\IEEEaftertitletext{LyX -> LaTeX -> LyX fails}

\maketitle


\begin{abstract}
Original document created in LyX (great tool!) but it was required to export to LaTeX for one collaborator. :(
Edited version reimported into LyX to continue work.

This document is a cut down sample of error.
\end{abstract}


\section{A section}

We need at least one lemma to show problem properly.

A famous lemma in computer arithmetic.

\begin{lem}
Exact Cancellation (Sterbenz')

If $\infty>x>y>0$ and $x,y\in\mathbb{F}_{\beta,p}$ and $y/x \ge 1/2$
then $x-y\in\mathbb{F}_{\beta,p}$. 

Where $\mathbb{F}_{\beta,p}$ denotes a floating point format in base $\beta$, $\beta \ge 2$ of precision $p$, $p > 0$.  
\end{lem}

Such lemmas should have citations, but this is a test file.


%
% PROBLEM HERE
%
And in Figure~\ref{Figure:tikz-import-failure} 
we can see problems caused during import.

A manual fix is to 
\begin{enumerate}
\item cut the tikz code from LyX document,
\item insert a Tex Code section, and 
\item paste code into teX code section (it also helps fix broken line ending in import).
\end{enumerate}


\begin{figure}[H]

    \tikzset{ 
    box/.style={
        draw, thin, shape=rectangle, minimum size=0.5cm, anchor=center, outer sep=0pt
    },
    widebox/.style={
    thin,
    minimum width=1.5cm, minimum height=0.5cm, anchor=center, inner sep=0pt, outer sep=0pt,
    append after command={
      \pgfextra{
      \path[draw, densely dotted,#1]
            decorate[decoration={zigzag, segment length=1em, amplitude=0.3em, pre=lineto, post=lineto }]
            { ([xshift=-0.5em] \tikzlastnode.north) -- ([xshift=+0.5em]  \tikzlastnode.north)}
            -- (\tikzlastnode.north east)
            -- (\tikzlastnode.south east)
            -- ([xshift=+0.5em] \tikzlastnode.south)
            decorate[decoration={zigzag, segment length=1em, amplitude=0.3em, pre=lineto, post=lineto }]
	  {  -- ([xshift=-0.5em] \tikzlastnode.south)}
	   -- (\tikzlastnode.south west)
	   -- (\tikzlastnode.north west)
	   -- cycle;
        } }
    },
    }
    
    \begin{center}
    \begin{tikzpicture}
    
    \node[box]             (A1)  at  (0.0, 0.0)  {$c$};    

    \node[widebox]         (A2)  at  (1.0, 0.0)  {$\cdots$};

    \node[box]             (A3)  at  (2.0, 0.0)  {$c$};

   
    
    \end{tikzpicture}
    \end{center}
    
    \label{Figure:tikz-import-failure}\caption{A Tikz figure causing errors}
    \end{figure}
     

\end{document}
