# Problem with label and references

Hello to all.

I am writing a book (two sides) on astronomy and navigation with a lot of
figures, tables and equations. I don't have any problem to reference in the
text to the apropiate labels of figures, tables, equations and chapters, but
when I put a label in a section title I have this two errors in the errors
window and obviuosly LyX don't produce the dvi output:

Error 1:
Argument of \...@straight@i has an extra }.

\section{Leyes de la fuerza magnética}

I've run across a }' that doesn't seem to match anything.
For example, \def\a#1{...}' and \a}' would produce
this error. If you simply proceed now, the \par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your }' was spurious, just type 2' and it will go away.

Error 2:
Paragrapgh ended before \...@straight@i was complete.

\section{Leyes de la fuerza magnética}

I suspect you've forgotten a }', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.

My book begins in the Chapter LXII because is the third of a collection and the
sections, figures, tables and equations are numerated acorddly. So, in my
preamble I have this first command:

\setcounter{chapter}{61}

In addition, I need to enumerate the sections in the form 6601, 6602,
6603....6701, 6702,....etc.. I do that with the sentence:

\renewcommand{\thesection}{\ifnum\value{section}<10
\arabic{chapter}0\arabic{section}\else\arabic{chapter}\arabic{section}\fi}

My book is in spanish language and my complete preamble is this one:

\setcounter{chapter}{61}
\usepackage[pagestyles]{titlesec}

\usepackage{ifthen}

\usepackage{graphicx}

\usepackage{float}

\usepackage{floatflt}

\usepackage{colortbl}

\usepackage{wrapfig}

\usepackage{enumitem}

\usepackage{eso-pic,everyshi,calc}

\usepackage{marvosym}

\usepackage{amssymb}

\usepackage{amsbsy}

\usepackage{mathtools}

\usepackage{yhmath}

\usepackage{txfonts}

\usepackage{textcomp}

\usepackage{mathcomp}

\usepackage[e]{esvect}

\usepackage[spanish]{babel}

\usepackage{ccaption}

\usepackage[labelsep=endash,font={small,it},labelformat=simple,labelfont=bf,figurewithin=none,justification=centering]{caption}

\renewcommand{\thechapter}{\Roman{chapter}}

\renewcommand{\thesection}{\ifnum\value{section}<10
\arabic{chapter}0\arabic{section}\else\arabic{chapter}\arabic{section}\fi}

\renewcommand{\sin}{\sen \nolimits}

\renewcommand{\arcsin}{\arcsen \nolimits}

\renewcommand{\sinh}{\senh \nolimits}

\renewcommand{\tan}{\tg \nolimits}

\renewcommand{\arctan}{\arctg \nolimits}

\renewcommand{\tanh}{\tgh \nolimits}

\renewcommand{\csc}{\cosec \nolimits}

\renewcommand{\cot}{\cotg \nolimits}

\renewcommand{\lg}{\log \nolimits}

\renewcommand{\theequation}{\arabic{chapter}.\arabic{equation}}

\DeclareMathOperator{\gs}{\textrm{\!\textdegree}}

\titleformat{\chapter}[display]

{\Large\bfseries\fillast\vspace{-25pt}}

{\normalfont\bfseries\chaptername\hspace{5pt}\thechapter}

{.5ex minus .1ex}

{\large}[\vspace{-15pt}]

\titleformat{\section}[runin]

{\normalfont\bfseries}

{\thesection.}{.5em}{}[.---\:]

\titlespacing{\section}

{\parindent}{1.5ex plus .1ex minus .2ex}{0pt}

\makeatletter

\def\cleardoublepage{\clearpage...@twoside \ifod...@page\else

\vspace*{\fill}

\thispagestyle{empty}

\newpage

\...@twocolumn\hbox{}\newpage\fi\fi\fi}

\makeatother

\setlist{noitemsep}

\setenumerate{labelindent=\parindent,leftmargin=*,labelsep=1em}

\setitemize{labelindent=\parindent,leftmargin=*,labelsep=1em}

\clubpenalty=10000

\widowpenalty=10000

Some help? Thank you very much in advance.

\usepackage[bookmarks=true,bookmarksopen=true,bookmarksopenlevel=2,bookmarksnumbered=true]{hyperref}
`