Spacing before and after section titles
I know this subject has been mentioned before, but I'm still having a problem in creating a space under a section title. I used the titlesec
package and then tried using the command titlespacing{section}
...
This is my code. Can anybody help?
documentclass[10pt]{book}
usepackage[utf8]{inputenc}
usepackage{fullpage}
usepackage[compact]{titlesec}
usepackage{setspace}
usepackage{sectsty}
chapterfont{huge}
sectionfont{Huge}
begin{document}
chapter*{Kapitel 1}
section*{Einleitung}
begin{large}
subsection*{1.1 Motivation}
spacing sectioning titlesec
|
show 5 more comments
I know this subject has been mentioned before, but I'm still having a problem in creating a space under a section title. I used the titlesec
package and then tried using the command titlespacing{section}
...
This is my code. Can anybody help?
documentclass[10pt]{book}
usepackage[utf8]{inputenc}
usepackage{fullpage}
usepackage[compact]{titlesec}
usepackage{setspace}
usepackage{sectsty}
chapterfont{huge}
sectionfont{Huge}
begin{document}
chapter*{Kapitel 1}
section*{Einleitung}
begin{large}
subsection*{1.1 Motivation}
spacing sectioning titlesec
1
Welcome to TeX.SX. A tip: If you indent lines by 4 spaces, then they're marked as a code sample. You can also highlight the code and click the "code" button ({}
) or hit Ctrl+K.
– Claudio Fiandrino
Apr 14 '13 at 13:05
Your given code is not compiling. Have you tested it? Please make it running. What shouldbegin{large}
do? Do you want there a greater space? Packageblindtext
helps you to include a little dummy text. See on CTAN.
– Kurt
Apr 14 '13 at 13:33
Thanks! But sorry I didn't get what you mean. So leave the titlespacing and just use the \ to make the spaces?
– abdu
Apr 14 '13 at 13:56
@user29019 but exactly what kind of space are you trying to get? Exactly how much space do you want after chapter andsection
?
– Gonzalo Medina
Apr 14 '13 at 14:55
@GonzaloMedina yes I tried it, it works. The begin{large} is for the font size of the text. So everything is working till now. But I need create a titlespacing under the 'Einleitung' so between the section title und the text beneath it. I'm a new LaTeX user, I'm writing a scientific thesis. so there would be chapters, section and subsections. I searched in the internet for packages and commands I found things like vspace, titlespacing{section}... but non of them worked, I compile the .tex file through a terminal (ubuntu) but I get no changes.
– abdu
Apr 14 '13 at 16:16
|
show 5 more comments
I know this subject has been mentioned before, but I'm still having a problem in creating a space under a section title. I used the titlesec
package and then tried using the command titlespacing{section}
...
This is my code. Can anybody help?
documentclass[10pt]{book}
usepackage[utf8]{inputenc}
usepackage{fullpage}
usepackage[compact]{titlesec}
usepackage{setspace}
usepackage{sectsty}
chapterfont{huge}
sectionfont{Huge}
begin{document}
chapter*{Kapitel 1}
section*{Einleitung}
begin{large}
subsection*{1.1 Motivation}
spacing sectioning titlesec
I know this subject has been mentioned before, but I'm still having a problem in creating a space under a section title. I used the titlesec
package and then tried using the command titlespacing{section}
...
This is my code. Can anybody help?
documentclass[10pt]{book}
usepackage[utf8]{inputenc}
usepackage{fullpage}
usepackage[compact]{titlesec}
usepackage{setspace}
usepackage{sectsty}
chapterfont{huge}
sectionfont{Huge}
begin{document}
chapter*{Kapitel 1}
section*{Einleitung}
begin{large}
subsection*{1.1 Motivation}
spacing sectioning titlesec
spacing sectioning titlesec
edited Apr 14 '13 at 13:05
Claudio Fiandrino
52.3k11152307
52.3k11152307
asked Apr 14 '13 at 13:03
abduabdu
66931018
66931018
1
Welcome to TeX.SX. A tip: If you indent lines by 4 spaces, then they're marked as a code sample. You can also highlight the code and click the "code" button ({}
) or hit Ctrl+K.
– Claudio Fiandrino
Apr 14 '13 at 13:05
Your given code is not compiling. Have you tested it? Please make it running. What shouldbegin{large}
do? Do you want there a greater space? Packageblindtext
helps you to include a little dummy text. See on CTAN.
– Kurt
Apr 14 '13 at 13:33
Thanks! But sorry I didn't get what you mean. So leave the titlespacing and just use the \ to make the spaces?
– abdu
Apr 14 '13 at 13:56
@user29019 but exactly what kind of space are you trying to get? Exactly how much space do you want after chapter andsection
?
– Gonzalo Medina
Apr 14 '13 at 14:55
@GonzaloMedina yes I tried it, it works. The begin{large} is for the font size of the text. So everything is working till now. But I need create a titlespacing under the 'Einleitung' so between the section title und the text beneath it. I'm a new LaTeX user, I'm writing a scientific thesis. so there would be chapters, section and subsections. I searched in the internet for packages and commands I found things like vspace, titlespacing{section}... but non of them worked, I compile the .tex file through a terminal (ubuntu) but I get no changes.
– abdu
Apr 14 '13 at 16:16
|
show 5 more comments
1
Welcome to TeX.SX. A tip: If you indent lines by 4 spaces, then they're marked as a code sample. You can also highlight the code and click the "code" button ({}
) or hit Ctrl+K.
– Claudio Fiandrino
Apr 14 '13 at 13:05
Your given code is not compiling. Have you tested it? Please make it running. What shouldbegin{large}
do? Do you want there a greater space? Packageblindtext
helps you to include a little dummy text. See on CTAN.
– Kurt
Apr 14 '13 at 13:33
Thanks! But sorry I didn't get what you mean. So leave the titlespacing and just use the \ to make the spaces?
– abdu
Apr 14 '13 at 13:56
@user29019 but exactly what kind of space are you trying to get? Exactly how much space do you want after chapter andsection
?
– Gonzalo Medina
Apr 14 '13 at 14:55
@GonzaloMedina yes I tried it, it works. The begin{large} is for the font size of the text. So everything is working till now. But I need create a titlespacing under the 'Einleitung' so between the section title und the text beneath it. I'm a new LaTeX user, I'm writing a scientific thesis. so there would be chapters, section and subsections. I searched in the internet for packages and commands I found things like vspace, titlespacing{section}... but non of them worked, I compile the .tex file through a terminal (ubuntu) but I get no changes.
– abdu
Apr 14 '13 at 16:16
1
1
Welcome to TeX.SX. A tip: If you indent lines by 4 spaces, then they're marked as a code sample. You can also highlight the code and click the "code" button (
{}
) or hit Ctrl+K.– Claudio Fiandrino
Apr 14 '13 at 13:05
Welcome to TeX.SX. A tip: If you indent lines by 4 spaces, then they're marked as a code sample. You can also highlight the code and click the "code" button (
{}
) or hit Ctrl+K.– Claudio Fiandrino
Apr 14 '13 at 13:05
Your given code is not compiling. Have you tested it? Please make it running. What should
begin{large}
do? Do you want there a greater space? Package blindtext
helps you to include a little dummy text. See on CTAN.– Kurt
Apr 14 '13 at 13:33
Your given code is not compiling. Have you tested it? Please make it running. What should
begin{large}
do? Do you want there a greater space? Package blindtext
helps you to include a little dummy text. See on CTAN.– Kurt
Apr 14 '13 at 13:33
Thanks! But sorry I didn't get what you mean. So leave the titlespacing and just use the \ to make the spaces?
– abdu
Apr 14 '13 at 13:56
Thanks! But sorry I didn't get what you mean. So leave the titlespacing and just use the \ to make the spaces?
– abdu
Apr 14 '13 at 13:56
@user29019 but exactly what kind of space are you trying to get? Exactly how much space do you want after chapter and
section
?– Gonzalo Medina
Apr 14 '13 at 14:55
@user29019 but exactly what kind of space are you trying to get? Exactly how much space do you want after chapter and
section
?– Gonzalo Medina
Apr 14 '13 at 14:55
@GonzaloMedina yes I tried it, it works. The begin{large} is for the font size of the text. So everything is working till now. But I need create a titlespacing under the 'Einleitung' so between the section title und the text beneath it. I'm a new LaTeX user, I'm writing a scientific thesis. so there would be chapters, section and subsections. I searched in the internet for packages and commands I found things like vspace, titlespacing{section}... but non of them worked, I compile the .tex file through a terminal (ubuntu) but I get no changes.
– abdu
Apr 14 '13 at 16:16
@GonzaloMedina yes I tried it, it works. The begin{large} is for the font size of the text. So everything is working till now. But I need create a titlespacing under the 'Einleitung' so between the section title und the text beneath it. I'm a new LaTeX user, I'm writing a scientific thesis. so there would be chapters, section and subsections. I searched in the internet for packages and commands I found things like vspace, titlespacing{section}... but non of them worked, I compile the .tex file through a terminal (ubuntu) but I get no changes.
– abdu
Apr 14 '13 at 16:16
|
show 5 more comments
3 Answers
3
active
oldest
votes
Using the titlesec
package you can use titlespacing*
you can change the spacing before and after the title; the syntax of the command is:
titlespacing*{<command>}{<left>}{<before-sep>}{<after-sep>}
(there's an additional optional argument, but it's not important here). <left>
increases the left margin; <before-sep>
controls the vertical space before the title; <after-sep>
controls the vertical space after the title. (Please refer to the package documentation for further information). A complete example:
documentclass[10pt]{book}
usepackage{titlesec}
usepackage{lipsum}% just to generate text for the example
titlespacing*{section}
{0pt}{5.5ex plus 1ex minus .2ex}{4.3ex plus .2ex}
titlespacing*{subsection}
{0pt}{5.5ex plus 1ex minus .2ex}{4.3ex plus .2ex}
begin{document}
chapter{Kapitel 1}
lipsum[4]
section{Einleitung}
lipsum[4]
subsection{Motivation}
lipsum[4]
end{document}
I used ex
(approximately the height of an "x" in the current font) as the unit for the lengths used, but you can use instead any other valid LaTeX unit (cm
, in
, mm
, pt
, among others); you can also use multiples of predefined lengths such as baselineskip:
titlespacing*{subsection}
{0pt}{2baselineskip}{3baselineskip}
I used ex since in this way the space is font-dependent. If you want to change the formatting of the titles, you can also use the same package and its powerful titleformat
command.
thanks very much! Everything worked, so now I know that I only have to use the titlesec package. I used the cm unit to change the spacing before the chapter and it worked! However I still have a problem, the one with the error. I can ignore it but it bothers while compiling through the terminal. I usually seperate two paragraphs with \ \ and this makes the error I think. Is there a way I can seperate paragraphs?
– abdu
Apr 15 '13 at 11:08
@abdu Yes, using two consecutive \ commands will result in errors. You can useparbigskip
instead at the end of each paragraph. Another option would be to load theparskip
package which automatically suppresses indentation and increases separation between paragraphs. Yet another option would be to switch to the document classscrreprt
and use itsparskip
features.
– Gonzalo Medina
Apr 15 '13 at 12:49
pasbigskip worked. I tried the parskip package by defining the skip length: setlength{parskip}{0pt} and then typing parskip between the paragraphs, but I got errors while compiling.
– abdu
Apr 15 '13 at 13:16
@abdu The idea with theparskip
package is just to load it; no need to setparskip
nor to explicitly callparskip
. You don't need the linesetlength{parskip}{0pt}
(you can delete it) and you don't need to useparskip
in your document.
– Gonzalo Medina
Apr 15 '13 at 13:34
2
@Adam_Gtexdoc texbytopic
(or The TeXbook) and search for glue. The answer to tex.stackexchange.com/q/64756/3954 can also give you an explanation.
– Gonzalo Medina
Nov 4 '15 at 23:50
|
show 4 more comments
If you don't need all the "baggage" of an additional package like titlesec
, you can simply modify these aspects of your headings yourself. See this example. I use a few sections and save the original section definition, so we can see a comparison.
I then define and use a section "prelude" prior to the invocation of the original section command. Then I add a "postlude" to the sectioning command. The prelude and the postlude here both add an extra em
of vertical space, but you could use it to put in other sectioning highlights like rules, etc.
documentclass{article}
begin{document}
section{First Section}
This is the first line of text. Note the vertical spacing.
section{Second Section}
Observe the spacing prior to and following the sectioning command. Now let me
redefine a few things.
makeatletter
letorigsectionsection
renewcommandsection{@ifstar{starsection}{nostarsection}}
newcommandnostarsection[1]
{sectionpreludeorigsection{#1}sectionpostlude}
newcommandstarsection[1]
{sectionpreludeorigsection*{#1}sectionpostlude}
newcommandsectionprelude{%
vspace{1em}
}
newcommandsectionpostlude{%
vspace{1em}
}
makeatother
section{Next Section}
Did this text drop 1em lower relative to the heading than the prior
section? If so, we have succeeded.
section{Final Section}
And the result is permananent, as you can see.
end{document}
Hey thanks for your answer Steven. But I think I'll use the titlesec package just because I know how it works now. And since I'm using the report class I need chapters sections and subsections it's makes more sense to use the titlesec package. But thanks a lot, I'll save your code and try to use it in the future! =)
– abdu
Apr 15 '13 at 11:01
@abdu. I understand completely. It's just one more option, depending on the particular need.
– Steven B. Segletes
Apr 15 '13 at 11:03
Nice! How would this work if I wanted to do the same forsubsection*
's?
– texfan
Aug 9 '16 at 13:52
3
@texfan If you take my source and do a global search and replace fromsection
tosubsection
, recompile and see the result.
– Steven B. Segletes
Aug 9 '16 at 13:55
@StevenB.Segletes Ah ok, I thought maybe there was a way to do both at once, but this works, thanks :)!
– texfan
Aug 10 '16 at 9:49
|
show 1 more comment
In case anybody wants to adjust the spaces while using KOMAscript -- @gonzalo's answer is not recommended since KOMA and titlesec are incompatible. However, KOMA provides commands to modify the section commands. The command
RedeclareSectionCommand[beforeskip=-5.5ex plus -1ex minus -.2ex,afterskip=4.3ex plus -.2ex]{section}
modifies the space before and after a section title to similar values.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f108684%2fspacing-before-and-after-section-titles%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Using the titlesec
package you can use titlespacing*
you can change the spacing before and after the title; the syntax of the command is:
titlespacing*{<command>}{<left>}{<before-sep>}{<after-sep>}
(there's an additional optional argument, but it's not important here). <left>
increases the left margin; <before-sep>
controls the vertical space before the title; <after-sep>
controls the vertical space after the title. (Please refer to the package documentation for further information). A complete example:
documentclass[10pt]{book}
usepackage{titlesec}
usepackage{lipsum}% just to generate text for the example
titlespacing*{section}
{0pt}{5.5ex plus 1ex minus .2ex}{4.3ex plus .2ex}
titlespacing*{subsection}
{0pt}{5.5ex plus 1ex minus .2ex}{4.3ex plus .2ex}
begin{document}
chapter{Kapitel 1}
lipsum[4]
section{Einleitung}
lipsum[4]
subsection{Motivation}
lipsum[4]
end{document}
I used ex
(approximately the height of an "x" in the current font) as the unit for the lengths used, but you can use instead any other valid LaTeX unit (cm
, in
, mm
, pt
, among others); you can also use multiples of predefined lengths such as baselineskip:
titlespacing*{subsection}
{0pt}{2baselineskip}{3baselineskip}
I used ex since in this way the space is font-dependent. If you want to change the formatting of the titles, you can also use the same package and its powerful titleformat
command.
thanks very much! Everything worked, so now I know that I only have to use the titlesec package. I used the cm unit to change the spacing before the chapter and it worked! However I still have a problem, the one with the error. I can ignore it but it bothers while compiling through the terminal. I usually seperate two paragraphs with \ \ and this makes the error I think. Is there a way I can seperate paragraphs?
– abdu
Apr 15 '13 at 11:08
@abdu Yes, using two consecutive \ commands will result in errors. You can useparbigskip
instead at the end of each paragraph. Another option would be to load theparskip
package which automatically suppresses indentation and increases separation between paragraphs. Yet another option would be to switch to the document classscrreprt
and use itsparskip
features.
– Gonzalo Medina
Apr 15 '13 at 12:49
pasbigskip worked. I tried the parskip package by defining the skip length: setlength{parskip}{0pt} and then typing parskip between the paragraphs, but I got errors while compiling.
– abdu
Apr 15 '13 at 13:16
@abdu The idea with theparskip
package is just to load it; no need to setparskip
nor to explicitly callparskip
. You don't need the linesetlength{parskip}{0pt}
(you can delete it) and you don't need to useparskip
in your document.
– Gonzalo Medina
Apr 15 '13 at 13:34
2
@Adam_Gtexdoc texbytopic
(or The TeXbook) and search for glue. The answer to tex.stackexchange.com/q/64756/3954 can also give you an explanation.
– Gonzalo Medina
Nov 4 '15 at 23:50
|
show 4 more comments
Using the titlesec
package you can use titlespacing*
you can change the spacing before and after the title; the syntax of the command is:
titlespacing*{<command>}{<left>}{<before-sep>}{<after-sep>}
(there's an additional optional argument, but it's not important here). <left>
increases the left margin; <before-sep>
controls the vertical space before the title; <after-sep>
controls the vertical space after the title. (Please refer to the package documentation for further information). A complete example:
documentclass[10pt]{book}
usepackage{titlesec}
usepackage{lipsum}% just to generate text for the example
titlespacing*{section}
{0pt}{5.5ex plus 1ex minus .2ex}{4.3ex plus .2ex}
titlespacing*{subsection}
{0pt}{5.5ex plus 1ex minus .2ex}{4.3ex plus .2ex}
begin{document}
chapter{Kapitel 1}
lipsum[4]
section{Einleitung}
lipsum[4]
subsection{Motivation}
lipsum[4]
end{document}
I used ex
(approximately the height of an "x" in the current font) as the unit for the lengths used, but you can use instead any other valid LaTeX unit (cm
, in
, mm
, pt
, among others); you can also use multiples of predefined lengths such as baselineskip:
titlespacing*{subsection}
{0pt}{2baselineskip}{3baselineskip}
I used ex since in this way the space is font-dependent. If you want to change the formatting of the titles, you can also use the same package and its powerful titleformat
command.
thanks very much! Everything worked, so now I know that I only have to use the titlesec package. I used the cm unit to change the spacing before the chapter and it worked! However I still have a problem, the one with the error. I can ignore it but it bothers while compiling through the terminal. I usually seperate two paragraphs with \ \ and this makes the error I think. Is there a way I can seperate paragraphs?
– abdu
Apr 15 '13 at 11:08
@abdu Yes, using two consecutive \ commands will result in errors. You can useparbigskip
instead at the end of each paragraph. Another option would be to load theparskip
package which automatically suppresses indentation and increases separation between paragraphs. Yet another option would be to switch to the document classscrreprt
and use itsparskip
features.
– Gonzalo Medina
Apr 15 '13 at 12:49
pasbigskip worked. I tried the parskip package by defining the skip length: setlength{parskip}{0pt} and then typing parskip between the paragraphs, but I got errors while compiling.
– abdu
Apr 15 '13 at 13:16
@abdu The idea with theparskip
package is just to load it; no need to setparskip
nor to explicitly callparskip
. You don't need the linesetlength{parskip}{0pt}
(you can delete it) and you don't need to useparskip
in your document.
– Gonzalo Medina
Apr 15 '13 at 13:34
2
@Adam_Gtexdoc texbytopic
(or The TeXbook) and search for glue. The answer to tex.stackexchange.com/q/64756/3954 can also give you an explanation.
– Gonzalo Medina
Nov 4 '15 at 23:50
|
show 4 more comments
Using the titlesec
package you can use titlespacing*
you can change the spacing before and after the title; the syntax of the command is:
titlespacing*{<command>}{<left>}{<before-sep>}{<after-sep>}
(there's an additional optional argument, but it's not important here). <left>
increases the left margin; <before-sep>
controls the vertical space before the title; <after-sep>
controls the vertical space after the title. (Please refer to the package documentation for further information). A complete example:
documentclass[10pt]{book}
usepackage{titlesec}
usepackage{lipsum}% just to generate text for the example
titlespacing*{section}
{0pt}{5.5ex plus 1ex minus .2ex}{4.3ex plus .2ex}
titlespacing*{subsection}
{0pt}{5.5ex plus 1ex minus .2ex}{4.3ex plus .2ex}
begin{document}
chapter{Kapitel 1}
lipsum[4]
section{Einleitung}
lipsum[4]
subsection{Motivation}
lipsum[4]
end{document}
I used ex
(approximately the height of an "x" in the current font) as the unit for the lengths used, but you can use instead any other valid LaTeX unit (cm
, in
, mm
, pt
, among others); you can also use multiples of predefined lengths such as baselineskip:
titlespacing*{subsection}
{0pt}{2baselineskip}{3baselineskip}
I used ex since in this way the space is font-dependent. If you want to change the formatting of the titles, you can also use the same package and its powerful titleformat
command.
Using the titlesec
package you can use titlespacing*
you can change the spacing before and after the title; the syntax of the command is:
titlespacing*{<command>}{<left>}{<before-sep>}{<after-sep>}
(there's an additional optional argument, but it's not important here). <left>
increases the left margin; <before-sep>
controls the vertical space before the title; <after-sep>
controls the vertical space after the title. (Please refer to the package documentation for further information). A complete example:
documentclass[10pt]{book}
usepackage{titlesec}
usepackage{lipsum}% just to generate text for the example
titlespacing*{section}
{0pt}{5.5ex plus 1ex minus .2ex}{4.3ex plus .2ex}
titlespacing*{subsection}
{0pt}{5.5ex plus 1ex minus .2ex}{4.3ex plus .2ex}
begin{document}
chapter{Kapitel 1}
lipsum[4]
section{Einleitung}
lipsum[4]
subsection{Motivation}
lipsum[4]
end{document}
I used ex
(approximately the height of an "x" in the current font) as the unit for the lengths used, but you can use instead any other valid LaTeX unit (cm
, in
, mm
, pt
, among others); you can also use multiples of predefined lengths such as baselineskip:
titlespacing*{subsection}
{0pt}{2baselineskip}{3baselineskip}
I used ex since in this way the space is font-dependent. If you want to change the formatting of the titles, you can also use the same package and its powerful titleformat
command.
answered Apr 14 '13 at 21:27
Gonzalo MedinaGonzalo Medina
396k4113011568
396k4113011568
thanks very much! Everything worked, so now I know that I only have to use the titlesec package. I used the cm unit to change the spacing before the chapter and it worked! However I still have a problem, the one with the error. I can ignore it but it bothers while compiling through the terminal. I usually seperate two paragraphs with \ \ and this makes the error I think. Is there a way I can seperate paragraphs?
– abdu
Apr 15 '13 at 11:08
@abdu Yes, using two consecutive \ commands will result in errors. You can useparbigskip
instead at the end of each paragraph. Another option would be to load theparskip
package which automatically suppresses indentation and increases separation between paragraphs. Yet another option would be to switch to the document classscrreprt
and use itsparskip
features.
– Gonzalo Medina
Apr 15 '13 at 12:49
pasbigskip worked. I tried the parskip package by defining the skip length: setlength{parskip}{0pt} and then typing parskip between the paragraphs, but I got errors while compiling.
– abdu
Apr 15 '13 at 13:16
@abdu The idea with theparskip
package is just to load it; no need to setparskip
nor to explicitly callparskip
. You don't need the linesetlength{parskip}{0pt}
(you can delete it) and you don't need to useparskip
in your document.
– Gonzalo Medina
Apr 15 '13 at 13:34
2
@Adam_Gtexdoc texbytopic
(or The TeXbook) and search for glue. The answer to tex.stackexchange.com/q/64756/3954 can also give you an explanation.
– Gonzalo Medina
Nov 4 '15 at 23:50
|
show 4 more comments
thanks very much! Everything worked, so now I know that I only have to use the titlesec package. I used the cm unit to change the spacing before the chapter and it worked! However I still have a problem, the one with the error. I can ignore it but it bothers while compiling through the terminal. I usually seperate two paragraphs with \ \ and this makes the error I think. Is there a way I can seperate paragraphs?
– abdu
Apr 15 '13 at 11:08
@abdu Yes, using two consecutive \ commands will result in errors. You can useparbigskip
instead at the end of each paragraph. Another option would be to load theparskip
package which automatically suppresses indentation and increases separation between paragraphs. Yet another option would be to switch to the document classscrreprt
and use itsparskip
features.
– Gonzalo Medina
Apr 15 '13 at 12:49
pasbigskip worked. I tried the parskip package by defining the skip length: setlength{parskip}{0pt} and then typing parskip between the paragraphs, but I got errors while compiling.
– abdu
Apr 15 '13 at 13:16
@abdu The idea with theparskip
package is just to load it; no need to setparskip
nor to explicitly callparskip
. You don't need the linesetlength{parskip}{0pt}
(you can delete it) and you don't need to useparskip
in your document.
– Gonzalo Medina
Apr 15 '13 at 13:34
2
@Adam_Gtexdoc texbytopic
(or The TeXbook) and search for glue. The answer to tex.stackexchange.com/q/64756/3954 can also give you an explanation.
– Gonzalo Medina
Nov 4 '15 at 23:50
thanks very much! Everything worked, so now I know that I only have to use the titlesec package. I used the cm unit to change the spacing before the chapter and it worked! However I still have a problem, the one with the error. I can ignore it but it bothers while compiling through the terminal. I usually seperate two paragraphs with \ \ and this makes the error I think. Is there a way I can seperate paragraphs?
– abdu
Apr 15 '13 at 11:08
thanks very much! Everything worked, so now I know that I only have to use the titlesec package. I used the cm unit to change the spacing before the chapter and it worked! However I still have a problem, the one with the error. I can ignore it but it bothers while compiling through the terminal. I usually seperate two paragraphs with \ \ and this makes the error I think. Is there a way I can seperate paragraphs?
– abdu
Apr 15 '13 at 11:08
@abdu Yes, using two consecutive \ commands will result in errors. You can use
parbigskip
instead at the end of each paragraph. Another option would be to load the parskip
package which automatically suppresses indentation and increases separation between paragraphs. Yet another option would be to switch to the document class scrreprt
and use its parskip
features.– Gonzalo Medina
Apr 15 '13 at 12:49
@abdu Yes, using two consecutive \ commands will result in errors. You can use
parbigskip
instead at the end of each paragraph. Another option would be to load the parskip
package which automatically suppresses indentation and increases separation between paragraphs. Yet another option would be to switch to the document class scrreprt
and use its parskip
features.– Gonzalo Medina
Apr 15 '13 at 12:49
pasbigskip worked. I tried the parskip package by defining the skip length: setlength{parskip}{0pt} and then typing parskip between the paragraphs, but I got errors while compiling.
– abdu
Apr 15 '13 at 13:16
pasbigskip worked. I tried the parskip package by defining the skip length: setlength{parskip}{0pt} and then typing parskip between the paragraphs, but I got errors while compiling.
– abdu
Apr 15 '13 at 13:16
@abdu The idea with the
parskip
package is just to load it; no need to set parskip
nor to explicitly call parskip
. You don't need the line setlength{parskip}{0pt}
(you can delete it) and you don't need to use parskip
in your document.– Gonzalo Medina
Apr 15 '13 at 13:34
@abdu The idea with the
parskip
package is just to load it; no need to set parskip
nor to explicitly call parskip
. You don't need the line setlength{parskip}{0pt}
(you can delete it) and you don't need to use parskip
in your document.– Gonzalo Medina
Apr 15 '13 at 13:34
2
2
@Adam_G
texdoc texbytopic
(or The TeXbook) and search for glue. The answer to tex.stackexchange.com/q/64756/3954 can also give you an explanation.– Gonzalo Medina
Nov 4 '15 at 23:50
@Adam_G
texdoc texbytopic
(or The TeXbook) and search for glue. The answer to tex.stackexchange.com/q/64756/3954 can also give you an explanation.– Gonzalo Medina
Nov 4 '15 at 23:50
|
show 4 more comments
If you don't need all the "baggage" of an additional package like titlesec
, you can simply modify these aspects of your headings yourself. See this example. I use a few sections and save the original section definition, so we can see a comparison.
I then define and use a section "prelude" prior to the invocation of the original section command. Then I add a "postlude" to the sectioning command. The prelude and the postlude here both add an extra em
of vertical space, but you could use it to put in other sectioning highlights like rules, etc.
documentclass{article}
begin{document}
section{First Section}
This is the first line of text. Note the vertical spacing.
section{Second Section}
Observe the spacing prior to and following the sectioning command. Now let me
redefine a few things.
makeatletter
letorigsectionsection
renewcommandsection{@ifstar{starsection}{nostarsection}}
newcommandnostarsection[1]
{sectionpreludeorigsection{#1}sectionpostlude}
newcommandstarsection[1]
{sectionpreludeorigsection*{#1}sectionpostlude}
newcommandsectionprelude{%
vspace{1em}
}
newcommandsectionpostlude{%
vspace{1em}
}
makeatother
section{Next Section}
Did this text drop 1em lower relative to the heading than the prior
section? If so, we have succeeded.
section{Final Section}
And the result is permananent, as you can see.
end{document}
Hey thanks for your answer Steven. But I think I'll use the titlesec package just because I know how it works now. And since I'm using the report class I need chapters sections and subsections it's makes more sense to use the titlesec package. But thanks a lot, I'll save your code and try to use it in the future! =)
– abdu
Apr 15 '13 at 11:01
@abdu. I understand completely. It's just one more option, depending on the particular need.
– Steven B. Segletes
Apr 15 '13 at 11:03
Nice! How would this work if I wanted to do the same forsubsection*
's?
– texfan
Aug 9 '16 at 13:52
3
@texfan If you take my source and do a global search and replace fromsection
tosubsection
, recompile and see the result.
– Steven B. Segletes
Aug 9 '16 at 13:55
@StevenB.Segletes Ah ok, I thought maybe there was a way to do both at once, but this works, thanks :)!
– texfan
Aug 10 '16 at 9:49
|
show 1 more comment
If you don't need all the "baggage" of an additional package like titlesec
, you can simply modify these aspects of your headings yourself. See this example. I use a few sections and save the original section definition, so we can see a comparison.
I then define and use a section "prelude" prior to the invocation of the original section command. Then I add a "postlude" to the sectioning command. The prelude and the postlude here both add an extra em
of vertical space, but you could use it to put in other sectioning highlights like rules, etc.
documentclass{article}
begin{document}
section{First Section}
This is the first line of text. Note the vertical spacing.
section{Second Section}
Observe the spacing prior to and following the sectioning command. Now let me
redefine a few things.
makeatletter
letorigsectionsection
renewcommandsection{@ifstar{starsection}{nostarsection}}
newcommandnostarsection[1]
{sectionpreludeorigsection{#1}sectionpostlude}
newcommandstarsection[1]
{sectionpreludeorigsection*{#1}sectionpostlude}
newcommandsectionprelude{%
vspace{1em}
}
newcommandsectionpostlude{%
vspace{1em}
}
makeatother
section{Next Section}
Did this text drop 1em lower relative to the heading than the prior
section? If so, we have succeeded.
section{Final Section}
And the result is permananent, as you can see.
end{document}
Hey thanks for your answer Steven. But I think I'll use the titlesec package just because I know how it works now. And since I'm using the report class I need chapters sections and subsections it's makes more sense to use the titlesec package. But thanks a lot, I'll save your code and try to use it in the future! =)
– abdu
Apr 15 '13 at 11:01
@abdu. I understand completely. It's just one more option, depending on the particular need.
– Steven B. Segletes
Apr 15 '13 at 11:03
Nice! How would this work if I wanted to do the same forsubsection*
's?
– texfan
Aug 9 '16 at 13:52
3
@texfan If you take my source and do a global search and replace fromsection
tosubsection
, recompile and see the result.
– Steven B. Segletes
Aug 9 '16 at 13:55
@StevenB.Segletes Ah ok, I thought maybe there was a way to do both at once, but this works, thanks :)!
– texfan
Aug 10 '16 at 9:49
|
show 1 more comment
If you don't need all the "baggage" of an additional package like titlesec
, you can simply modify these aspects of your headings yourself. See this example. I use a few sections and save the original section definition, so we can see a comparison.
I then define and use a section "prelude" prior to the invocation of the original section command. Then I add a "postlude" to the sectioning command. The prelude and the postlude here both add an extra em
of vertical space, but you could use it to put in other sectioning highlights like rules, etc.
documentclass{article}
begin{document}
section{First Section}
This is the first line of text. Note the vertical spacing.
section{Second Section}
Observe the spacing prior to and following the sectioning command. Now let me
redefine a few things.
makeatletter
letorigsectionsection
renewcommandsection{@ifstar{starsection}{nostarsection}}
newcommandnostarsection[1]
{sectionpreludeorigsection{#1}sectionpostlude}
newcommandstarsection[1]
{sectionpreludeorigsection*{#1}sectionpostlude}
newcommandsectionprelude{%
vspace{1em}
}
newcommandsectionpostlude{%
vspace{1em}
}
makeatother
section{Next Section}
Did this text drop 1em lower relative to the heading than the prior
section? If so, we have succeeded.
section{Final Section}
And the result is permananent, as you can see.
end{document}
If you don't need all the "baggage" of an additional package like titlesec
, you can simply modify these aspects of your headings yourself. See this example. I use a few sections and save the original section definition, so we can see a comparison.
I then define and use a section "prelude" prior to the invocation of the original section command. Then I add a "postlude" to the sectioning command. The prelude and the postlude here both add an extra em
of vertical space, but you could use it to put in other sectioning highlights like rules, etc.
documentclass{article}
begin{document}
section{First Section}
This is the first line of text. Note the vertical spacing.
section{Second Section}
Observe the spacing prior to and following the sectioning command. Now let me
redefine a few things.
makeatletter
letorigsectionsection
renewcommandsection{@ifstar{starsection}{nostarsection}}
newcommandnostarsection[1]
{sectionpreludeorigsection{#1}sectionpostlude}
newcommandstarsection[1]
{sectionpreludeorigsection*{#1}sectionpostlude}
newcommandsectionprelude{%
vspace{1em}
}
newcommandsectionpostlude{%
vspace{1em}
}
makeatother
section{Next Section}
Did this text drop 1em lower relative to the heading than the prior
section? If so, we have succeeded.
section{Final Section}
And the result is permananent, as you can see.
end{document}
edited Apr 15 '13 at 10:59
answered Apr 15 '13 at 10:51
Steven B. SegletesSteven B. Segletes
153k9193402
153k9193402
Hey thanks for your answer Steven. But I think I'll use the titlesec package just because I know how it works now. And since I'm using the report class I need chapters sections and subsections it's makes more sense to use the titlesec package. But thanks a lot, I'll save your code and try to use it in the future! =)
– abdu
Apr 15 '13 at 11:01
@abdu. I understand completely. It's just one more option, depending on the particular need.
– Steven B. Segletes
Apr 15 '13 at 11:03
Nice! How would this work if I wanted to do the same forsubsection*
's?
– texfan
Aug 9 '16 at 13:52
3
@texfan If you take my source and do a global search and replace fromsection
tosubsection
, recompile and see the result.
– Steven B. Segletes
Aug 9 '16 at 13:55
@StevenB.Segletes Ah ok, I thought maybe there was a way to do both at once, but this works, thanks :)!
– texfan
Aug 10 '16 at 9:49
|
show 1 more comment
Hey thanks for your answer Steven. But I think I'll use the titlesec package just because I know how it works now. And since I'm using the report class I need chapters sections and subsections it's makes more sense to use the titlesec package. But thanks a lot, I'll save your code and try to use it in the future! =)
– abdu
Apr 15 '13 at 11:01
@abdu. I understand completely. It's just one more option, depending on the particular need.
– Steven B. Segletes
Apr 15 '13 at 11:03
Nice! How would this work if I wanted to do the same forsubsection*
's?
– texfan
Aug 9 '16 at 13:52
3
@texfan If you take my source and do a global search and replace fromsection
tosubsection
, recompile and see the result.
– Steven B. Segletes
Aug 9 '16 at 13:55
@StevenB.Segletes Ah ok, I thought maybe there was a way to do both at once, but this works, thanks :)!
– texfan
Aug 10 '16 at 9:49
Hey thanks for your answer Steven. But I think I'll use the titlesec package just because I know how it works now. And since I'm using the report class I need chapters sections and subsections it's makes more sense to use the titlesec package. But thanks a lot, I'll save your code and try to use it in the future! =)
– abdu
Apr 15 '13 at 11:01
Hey thanks for your answer Steven. But I think I'll use the titlesec package just because I know how it works now. And since I'm using the report class I need chapters sections and subsections it's makes more sense to use the titlesec package. But thanks a lot, I'll save your code and try to use it in the future! =)
– abdu
Apr 15 '13 at 11:01
@abdu. I understand completely. It's just one more option, depending on the particular need.
– Steven B. Segletes
Apr 15 '13 at 11:03
@abdu. I understand completely. It's just one more option, depending on the particular need.
– Steven B. Segletes
Apr 15 '13 at 11:03
Nice! How would this work if I wanted to do the same for
subsection*
's?– texfan
Aug 9 '16 at 13:52
Nice! How would this work if I wanted to do the same for
subsection*
's?– texfan
Aug 9 '16 at 13:52
3
3
@texfan If you take my source and do a global search and replace from
section
to subsection
, recompile and see the result.– Steven B. Segletes
Aug 9 '16 at 13:55
@texfan If you take my source and do a global search and replace from
section
to subsection
, recompile and see the result.– Steven B. Segletes
Aug 9 '16 at 13:55
@StevenB.Segletes Ah ok, I thought maybe there was a way to do both at once, but this works, thanks :)!
– texfan
Aug 10 '16 at 9:49
@StevenB.Segletes Ah ok, I thought maybe there was a way to do both at once, but this works, thanks :)!
– texfan
Aug 10 '16 at 9:49
|
show 1 more comment
In case anybody wants to adjust the spaces while using KOMAscript -- @gonzalo's answer is not recommended since KOMA and titlesec are incompatible. However, KOMA provides commands to modify the section commands. The command
RedeclareSectionCommand[beforeskip=-5.5ex plus -1ex minus -.2ex,afterskip=4.3ex plus -.2ex]{section}
modifies the space before and after a section title to similar values.
add a comment |
In case anybody wants to adjust the spaces while using KOMAscript -- @gonzalo's answer is not recommended since KOMA and titlesec are incompatible. However, KOMA provides commands to modify the section commands. The command
RedeclareSectionCommand[beforeskip=-5.5ex plus -1ex minus -.2ex,afterskip=4.3ex plus -.2ex]{section}
modifies the space before and after a section title to similar values.
add a comment |
In case anybody wants to adjust the spaces while using KOMAscript -- @gonzalo's answer is not recommended since KOMA and titlesec are incompatible. However, KOMA provides commands to modify the section commands. The command
RedeclareSectionCommand[beforeskip=-5.5ex plus -1ex minus -.2ex,afterskip=4.3ex plus -.2ex]{section}
modifies the space before and after a section title to similar values.
In case anybody wants to adjust the spaces while using KOMAscript -- @gonzalo's answer is not recommended since KOMA and titlesec are incompatible. However, KOMA provides commands to modify the section commands. The command
RedeclareSectionCommand[beforeskip=-5.5ex plus -1ex minus -.2ex,afterskip=4.3ex plus -.2ex]{section}
modifies the space before and after a section title to similar values.
answered Jan 8 at 9:58
TwonkyTwonky
276213
276213
add a comment |
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f108684%2fspacing-before-and-after-section-titles%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Welcome to TeX.SX. A tip: If you indent lines by 4 spaces, then they're marked as a code sample. You can also highlight the code and click the "code" button (
{}
) or hit Ctrl+K.– Claudio Fiandrino
Apr 14 '13 at 13:05
Your given code is not compiling. Have you tested it? Please make it running. What should
begin{large}
do? Do you want there a greater space? Packageblindtext
helps you to include a little dummy text. See on CTAN.– Kurt
Apr 14 '13 at 13:33
Thanks! But sorry I didn't get what you mean. So leave the titlespacing and just use the \ to make the spaces?
– abdu
Apr 14 '13 at 13:56
@user29019 but exactly what kind of space are you trying to get? Exactly how much space do you want after chapter and
section
?– Gonzalo Medina
Apr 14 '13 at 14:55
@GonzaloMedina yes I tried it, it works. The begin{large} is for the font size of the text. So everything is working till now. But I need create a titlespacing under the 'Einleitung' so between the section title und the text beneath it. I'm a new LaTeX user, I'm writing a scientific thesis. so there would be chapters, section and subsections. I searched in the internet for packages and commands I found things like vspace, titlespacing{section}... but non of them worked, I compile the .tex file through a terminal (ubuntu) but I get no changes.
– abdu
Apr 14 '13 at 16:16