Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I was trying to eliminate the vertical space before and after the title of a section by using the titlesec package and the command \titlespacing*{\section}{0pt}{0pt}{0pt}, but it works only in eliminating the vertical space after the section title. Before the section title there still is a portion of double space. I've searched the database and didn't find a solution.

share|improve this question
    
Do you use the setspace package and \doublespacing? A a minimal working example (MWE) would be helpful. –  lockstep Jan 8 '12 at 13:40
    
No, I don't. I use Lyx 2.0.2 with default settings. In the preamble I have \usepackage{fontspec} \usepackage{xunicode} \usepackage{xltxtra} \date{} \usepackage[compact]{titlesec} \titlespacing*{\section}{0pt}{*0}{0pt} –  chimil Jan 8 '12 at 13:43
    
Now I clicked to see the complete source and setspace appears with \onehalfspacing. But the space before the section title is clearly bigger than the one after. –  chimil Jan 8 '12 at 13:47
    
Check your PDF (or DVI) ouutput file -- perhaps the problem is limited to LyX's display. –  lockstep Jan 8 '12 at 13:47
1  
I've checked it. The same problem in the PDF xetex output. –  chimil Jan 8 '12 at 13:50
show 4 more comments

1 Answer

up vote 1 down vote accepted

Don't switch to \normalsize inside the argument of \section; use titlesecs \titleformat macro instead.

\documentclass[12pt]{extarticle}

\usepackage{setspace}
\onehalfspacing

\usepackage[compact]{titlesec}
\titleformat{\section}{\normalfont\bfseries}{\thesection}{1em}{}
\titlespacing*{\section}{0pt}{*0}{0pt}

\begin{document}

\section*{LOT}

The LOT hypothesis

\section*{The Regress Argument}

RA

\end{document}

enter image description here

share|improve this answer
    
Thank you so much, I just had to add titleformat{\section}{\normalfont\bfseries}{\thesection}{1em}{} to my preamble and it solved the problem, although I couldn't edit the source code in LyX and the \normalsize setting is still there. But it works this way. –  chimil Jan 8 '12 at 14:20
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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