Featured Book

LaTeX Beginners Guide

Who is online

In total there are 9 users online :: 0 registered, 0 hidden and 9 guests (based on users active over the past 5 minutes)
Most users ever online was 1327 on Tue Nov 05, 2013 7:11 pm

Users browsing this forum: No registered users and 9 guests

Partner Sites

TeXwelt - Fragen und Antworten goLaTeX
TeXblog
TeXnicCenter
TeXample

Make custom title Topic is solved

maketitleprogrammingsectioningAdd tags Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)

Make custom title

Postby Hermano on Thu May 16th, 2013

Dear all,

This is maybe a stupid question but I can not find how to define a preamble for my own (custom) title "\boldtitle". I can not use \maketitle as this gives me errors. It will be used as a sort of section but without numbering.

Code: Select all  •  Open in writeLaTeX
\newcommand\boldtitle{?????}

\begin{document}

\boldtitle{[b]This is my title[/b]}

\end{document
}


I want the title in bold that is left aligned an that has a defined white space before and after.

Thanks!
Last edited by cgnieder on Thu May 16th, 2013, edited 1 time in total.
Reason: added code markup
Hermano
 
Posts: 14
Joined: Wed Apr 6th, 2011

Re: Make custom title

Postby cgnieder on Thu May 16th, 2013

Hermano wrote:This is maybe a stupid question but I can not find how to define a preamble for my own (custom) title "\boldtitle". I can not use \maketitle as this gives me errors. It will be used as a sort of section but without numbering.


I don't really understand: do you want to customize the title that is made by \title, \author and \maketitle or do you want an unnumbered section (\section*{I'm not numbered})?

Regards
Clemens
------------------------------
New German Q&A site about TeX: http://texwelt.de/wissen
System: TeXlive 2013, OpenSUSE 12.3
User avatar
cgnieder
Site Moderator
 
Posts: 1675
Joined: Sat Apr 16th, 2011
Location: Germany

Re: Make custom title

Postby Hermano on Thu May 16th, 2013

I don't want to customize the title made by \title etc.
I want to create my own "title/heading" for a section which is not numbered and also not in the table of contents.

I can make it easily like:

Code: Select all  •  Open in writeLaTeX
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.  \\

\noindent{\textbf{This is my title}} \\

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.


But as I will use this format for a "title" many times, I want to create a preamble named "\boldtitle" such it looks like:

Code: Select all  •  Open in writeLaTeX
\boldtitle{This is my title}


In this preamable, I want to define the spacings before and after the title, bold text, not numbered, left aligned and not in taken into account for the table of contents.
Last edited by cgnieder on Thu May 16th, 2013, edited 1 time in total.
Reason: added code markup
Hermano
 
Posts: 14
Joined: Wed Apr 6th, 2011

Re: Make custom title

Postby cgnieder on Thu May 16th, 2013

Hermano wrote:I want to create my own "title/heading" for a section which is not numbered and also not in the table of contents.


There's already a command for this: the starred version of \section:

Code: Select all  •  Open in writeLaTeX
\section*{Unnumbered section that will not appear in the ToC}


BTW: you shouldn't use \\ to terminate a paragraph. An empty line in the source suffices. \\ does not terminate a paragraph, anyway, but ends a line, which is a different thing.

Regards
Clemens
------------------------------
New German Q&A site about TeX: http://texwelt.de/wissen
System: TeXlive 2013, OpenSUSE 12.3
User avatar
cgnieder
Site Moderator
 
Posts: 1675
Joined: Sat Apr 16th, 2011
Location: Germany

Re: Make custom title

Postby Hermano on Thu May 16th, 2013

Dear cgnieder,

Thanks for the answer!
However, using \section*{} will make the fontsize bigger than the rest of my text. Is there a way to specify the size once for whole my document for the \section*{} command in such a way it doesn't influence the fontsize of the \section{} command?
Last edited by cgnieder on Thu May 16th, 2013, edited 1 time in total.
Reason: added code markup
Hermano
 
Posts: 14
Joined: Wed Apr 6th, 2011

Re: Make custom title  Topic is solved

Postby cgnieder on Thu May 16th, 2013

You could adapt the definition of \section from article.cls. The code below defines a macro \mycustomhead which works exactly like \section except that it uses \normalsize instead of \large. I also defined a second command \myhead that simply calls the starred variant of \mycustomhead in order to get an unnumbered heading without entry in the ToC:

Code: Select all  •  Open in writeLaTeX
\documentclass{article}
\usepackage[T1]{fontenc
}

\makeatletter
\newcommand\mycustomhead{%
  \@startsection{section}{1}{\z@}%
  {-3.5ex \@plus -1ex \@minus -.2ex}%
  {2.3ex \@plus.2ex}%
  {\normalfont\normalsize\bfseries}}
\newcommand\myhead[1]{\mycustomhead*{#1}}
\makeatother

\usepackage{lipsum
}% dummy text

\begin{document}

\section{test}
\lipsum[1]

\myhead{custom head}
\lipsum[1]

\end{document
}


Regards
Clemens
------------------------------
New German Q&A site about TeX: http://texwelt.de/wissen
System: TeXlive 2013, OpenSUSE 12.3
User avatar
cgnieder
Site Moderator
 
Posts: 1675
Joined: Sat Apr 16th, 2011
Location: Germany

Re: Make custom title

Postby Hermano on Thu May 16th, 2013

Thanks cgnieder for your clear answer! This solved mu problem!

Thanks
Hermano
 
Posts: 14
Joined: Wed Apr 6th, 2011


Topic Tags

maketitleprogrammingsectioning

Return to Text Formatting

Who is online

Users browsing this forum: No registered users and 9 guests