2

This question already has an answer here:

I can see it in my lyx editor there is number in my section enter image description here

but when I render the pdf there is no number in my section enter image description here

anyone can help me? I think there is a problem with my preamble but I don't know which one because when I delete all my preamble the number is shown

It's seems the problem is with \usepackage{titlesec} what make me confuse is

it only happen in my computer,

when I try to render the same file in my friend's computer the number is shown

my latex preamble

%% \renewcommand{\chapter}[1]{\chapter[#1]{\centering #1}}
\usepackage{titlesec}
\usepackage{graphicx}
\usepackage{pdflscape}
\usepackage{colortbl}
\usepackage{amsmath}
\usepackage{color}
\usepackage{tocbibind}
\usepackage{url}
\usepackage[titletoc]{appendix}
\definecolor{lineno}{rgb}{0.5,0.5,0.5}
\definecolor{bcolor}{rgb}{0.98,0.98,0.98}
\definecolor{code}{rgb}{0,0.1,0.6}
\definecolor{codesty}{rgb}{0.7,0.1,0.1}
\definecolor{commandsty}{rgb}{0.1,0.5,0.0}
\definecolor{keywordsty}{rgb}{0.4,0.0,0.4}
\definecolor{stringsty}{rgb}{1.0,0.5,0.0}
\titleformat{\chapter}[display]
  {\normalfont\huge\bfseries\centering}{\chaptertitlename\thechapter}{20pt}{\Huge}
\renewcommand{\contentsname}{Table of Contents}
\setlength{\headheight}{15pt}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{Chapter  \thechapter.\ #1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}{}}

\fancyhf{}
\fancyhead[LE,RO]{\thepage}
\fancyhead[RE]{\textit{\nouppercase{\leftmark}}}
\fancyhead[LO]{\textit{\nouppercase{\rightmark}}}

\fancypagestyle{plain}{ %
\fancyhf{} % remove everything
\fancyfoot[C]{\thepage}
\renewcommand{\headrulewidth}{0pt} % remove lines as well
\renewcommand{\footrulewidth}{0pt}}
\usepackage[margin=10pt,font=small,labelfont=bf,labelsep=endash]{caption}

marked as duplicate by Torbjørn T., Ronny, user13907, Andrew Swann, Maarten Dhondt Sep 29 '16 at 13:00

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 5
    I think the problem is related with this one, tex.stackexchange.com/questions/299969/…. – buncis Sep 29 '16 at 9:46
  • If that is the case, you don't load titlesec package, unless you need to modify you sections. Which is your document class? Did you try to change it? – Yorgos Sep 29 '16 at 9:50
  • @Yorgos my class is book standard class? is that wrong? – buncis Sep 29 '16 at 9:55
  • no i don't think so... but try article or koma-script book to see if there is a difference – Yorgos Sep 29 '16 at 10:08
  • 2
    You may have the version of titlesec with that bug (which explains why it works at your friends computer). Try updating the package -- see tex.stackexchange.com/questions/55437/… for instructions on updating. – Torbjørn T. Sep 29 '16 at 11:20
2

this is a bug from the titlesec/tex-live itself

https://bugs.launchpad.net/ubuntu/+source/texlive-extra/+bug/1574052

this is happen because I upgrade my ubuntu distributions to 16.04,

upgrading lyx using the stable ppa doesn't fix it https://launchpad.net/~lyx-devel/+archive/ubuntu/release

one of the workaround is adding this in preamble

\usepackage{etoolbox}

\makeatletter
\patchcmd{\ttlh@hang}{\parindent\z@}{\parindent\z@\leavevmode}{}{}
\patchcmd{\ttlh@hang}{\noindent}{}{}{}
\makeatother

another workaround is upgrade your whole texlive version to 2016 version, default ubuntu repository only have 2015 version, so you need to add this PPA https://launchpad.net/~jonathonf/+archive/ubuntu/texlive-2016

or do manual install https://www.tug.org/texlive/quickinstall.html

  • 1
    The LyX version has nothing whatsoever to do with this bug, it is titlesec that is the problem. – Torbjørn T. Sep 29 '16 at 11:31

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