View previous topic :: View next topic |
Author |
Message |
juniper l33t
Joined: 22 Oct 2004 Posts: 943 Location: we the north
|
Posted: Thu Sep 17, 2009 9:32 pm Post subject: latex question about redefining subsection command |
|
|
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 |
|
|
timeBandit Bodhisattva
Joined: 31 Dec 2004 Posts: 2719 Location: here, there or in transit
|
Posted: Fri Sep 18, 2009 5:36 am Post subject: |
|
|
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 |
|
|
kamilian n00b
Joined: 23 Jun 2003 Posts: 59 Location: Sydney, Australia
|
Posted: Fri Sep 18, 2009 5:48 am Post subject: |
|
|
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 |
|
|
juniper l33t
Joined: 22 Oct 2004 Posts: 943 Location: we the north
|
Posted: Fri Sep 18, 2009 2:17 pm Post subject: |
|
|
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 |
|
|
kamilian n00b
Joined: 23 Jun 2003 Posts: 59 Location: Sydney, Australia
|
Posted: Sat Sep 19, 2009 1:38 am Post subject: |
|
|
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 |
|
|
ppurka Advocate
Joined: 26 Dec 2004 Posts: 3256
|
Posted: Sat Sep 19, 2009 6:30 am Post subject: |
|
|
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 |
|
|
Bircoph Developer
Joined: 27 Jun 2008 Posts: 261 Location: Moscow
|
Posted: Tue Sep 22, 2009 5:37 am Post subject: |
|
|
Use titlesec package. It allows to redefine standart titles, including subsection and has a good docs . _________________ Per aspera ad astra! |
|
Back to top |
|
|
|