Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
latex question about redefining subsection command
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
juniper
l33t
l33t


Joined: 22 Oct 2004
Posts: 943
Location: we the north

PostPosted: Thu Sep 17, 2009 9:32 pm    Post subject: latex question about redefining subsection command Reply with quote

I want my subsection command to do the following.

1) section font be bold
2) period and space after the section name
3) not force the following text (i.e. the actual beginning of the section) to a newline
4) have some vertical space before the section name (say 0.2cm)

the code

Code:

\renewcommand{\subsection}{\@startsection{subsection}{2}{0cm}{\parskip}{0.5\parskip}{\bf }}


solves 1) and 3), but not 2) and 4). any ideas?
Back to top
View user's profile Send private message
timeBandit
Bodhisattva
Bodhisattva


Joined: 31 Dec 2004
Posts: 2719
Location: here, there or in transit

PostPosted: Fri Sep 18, 2009 5:36 am    Post subject: Reply with quote

Moved from Off the Wall to Other Things Gentoo.
_________________
Plants are pithy, brooks tend to babble--I'm content to lie between them.
Super-short f.g.o checklist: Search first, strip comments, mark solved, help others.
Back to top
View user's profile Send private message
kamilian
n00b
n00b


Joined: 23 Jun 2003
Posts: 59
Location: Sydney, Australia

PostPosted: Fri Sep 18, 2009 5:48 am    Post subject: Reply with quote

At the end of this page there's an explanation of \@startsection indicating that the 4th argument is the "before skip". Modifying that (which is set to \parskip in your example) should help with 4).

For 2), is there a reason you can't make your own subsection command like this and use it instead of \subsection?

Code:
\newcommand{\mysubsection}[1]{\subsection{#1.}}

_________________
May contain traces of nuts.
Back to top
View user's profile Send private message
juniper
l33t
l33t


Joined: 22 Oct 2004
Posts: 943
Location: we the north

PostPosted: Fri Sep 18, 2009 2:17 pm    Post subject: Reply with quote

kamilian wrote:
At the end of this page there's an explanation of \@startsection indicating that the 4th argument is the "before skip". Modifying that (which is set to \parskip in your example) should help with 4).

For 2), is there a reason you can't make your own subsection command like this and use it instead of \subsection?

Code:
\newcommand{\mysubsection}[1]{\subsection{#1.}}


Actually, I wanted the period to come AFTER the section title, not section number. So, I guess I am asking how to make marks after the section tiitle.

your tip for 4) worked. thanks.
Back to top
View user's profile Send private message
kamilian
n00b
n00b


Joined: 23 Jun 2003
Posts: 59
Location: Sydney, Australia

PostPosted: Sat Sep 19, 2009 1:38 am    Post subject: Reply with quote

I'm not sure what you're doing wrong but it places a period after the title when I try it.

This simple example has a period at the end of the line using \mysubsection. If you uncomment the two lines it will place a period after the subsection numbers as well

Code:
\documentclass{article}

\newcommand{\mysubsection}[1]{\subsection{#1.}}
%\let\oldthesubsection\thesubsection
%\renewcommand{\thesubsection}{\oldthesubsection.}

\begin{document}
\section{This is a section}
\subsection{This is a subsection}
\mysubsection{This is a mysubsection}
\end{document}

_________________
May contain traces of nuts.
Back to top
View user's profile Send private message
ppurka
Advocate
Advocate


Joined: 26 Dec 2004
Posts: 3256

PostPosted: Sat Sep 19, 2009 6:30 am    Post subject: Reply with quote

You can probably also look at the amsart style file and see how the subsection is defined there. I think you get the period and the space after the subsection title.
_________________
emerge --quiet redefined | E17 vids: I, II | Now using kde5 | e is unstable :-/
Back to top
View user's profile Send private message
Bircoph
Developer
Developer


Joined: 27 Jun 2008
Posts: 261
Location: Moscow

PostPosted: Tue Sep 22, 2009 5:37 am    Post subject: Reply with quote

Use titlesec package. It allows to redefine standart titles, including subsection and has a good docs :wink: .
_________________
Per aspera ad astra!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum