How to add a subtitle in class article in Latex? - latex

I am writing a report in Latex and my document class must be article. I want to add some additional text under my title but I can't find anything that would correspond to a subtitle command. Does anyone have any suggestions?
\documentclass[11pt,a4paper]{article}
\title {Title}
\author{Name}

\documentclass[11pt,a4paper]{article}
\title {Title}
\author{Name}
\makeatletter
\def\#maketitle{%
\newpage
\null
\vskip 2em%
\begin{center}%
\let \footnote \thanks
{\LARGE \#title \par}%
\vskip 1em%
{\Large Whatever Subtitle you want\par}%
\vskip 1.5em%
{\large
\lineskip .5em%
\begin{tabular}[t]{c}%
\#author
\end{tabular}\par}%
\vskip 1em%
{\large \#date}%
\end{center}%
\par
\vskip 1.5em}
\makeatother
\begin{document}
\maketitle
test
\end{document}

Hopefully, I found a very easy and quick solution:
\documentclass[11pt,a4paper]{article}
\title {Title \\[1ex] \large Subtitle}
\author{Name}
\begin{document}
\maketitle
Text.
\end{document}

Related

How can I make the document title bold and larger in size?

I have this LaTeX code and I was wondering how can I make the document title bold and larger in size than the default size.
\documentclass{article}
\title{Document Title}
\begin{document}
\maketitle
The content of the document goes here.
\end{document}
I've noticed that \maketitle renders the content that is specified above in the preamble.
You could redefine \#maketitle:
\documentclass{article}
\title{Document Title}
\makeatletter
\def\#maketitle{%
\newpage
\null
\vskip 2em%
\begin{center}%
\let \footnote \thanks
{\Huge\bfseries\#title \par}%
\vskip 1.5em%
{\large
\lineskip .5em%
\begin{tabular}[t]{c}%
\#author
\end{tabular}\par}%
\vskip 1em%
{\large \#date}%
\end{center}%
\par
\vskip 1.5em}
\makeatother
\begin{document}
\maketitle
The content of the document goes here.
\end{document}

Add some space befor TOC title in latex

I trying add some space before TOC , I used \vspace but it doesn't work
\documentclass[12pt, french,a4paper]{report}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\begin{document}
%...
\vspace*{.3\paperheight} %doesn't work
\tableofcontents
%...
\chapter{chapitre}
\section{section}
\subsection{subsection}
\newpage
\chapter{chapitre}
\section{section}
\subsection{subsection}
\end{document}
somebody have solution ?
The toc will automatically start a new chapter on a new page. If you use \vspace before it, this will still be on the previous page and not have any effect on your toc. However, you can change the definition of the toc and add some space there:
\documentclass[12pt, french,a4paper]{report}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\makeatletter
\renewcommand\tableofcontents{%
\if#twocolumn
\#restonecoltrue\onecolumn
\else
\#restonecolfalse
\fi
\chapter*{\vspace{5cm}\contentsname
\#mkboth{%
\MakeUppercase\contentsname}{\MakeUppercase\contentsname}}%
\#starttoc{toc}%
\if#restonecol\twocolumn\fi
}
\makeatother
\begin{document}
%...
\tableofcontents
%...
\chapter{chapitre}
\section{section}
\subsection{subsection}
\newpage
\chapter{chapitre}
\section{section}
\subsection{subsection}
\end{document}

Overfull \hbox error when indenting paragraph in LaTex

I would like to indent the whole paragraph "lipsum[2]" but I am getting an "overfull \hbox" error and the paragraph goes out of the page's boundaries. How can I fix that? Thank you in advance!
\documentclass[jou]{apa7}
\usepackage{lipsum}
\title{Title of the paper}
\author{Author}
\begin{document}
\maketitle
\lipsum[1]
\hfill\begin{minipage}{\dimexpr\textwidth-3cm}
\lipsum[2]
\end{minipage}
\end{document}
You want to use \linewidth and not \textwidth:
\documentclass[jou]{apa7}
\usepackage{lipsum}
\title{Title of the paper}
\author{Author}
\begin{document}
\maketitle
\lipsum[1]
\hfill\begin{minipage}{\dimexpr\linewidth-3cm}
\lipsum[2]
\end{minipage}
\end{document}

Table of content in latex

Could you help me to solve this problem? How I can separate the table of content, list of figure, list of table in different line in content?
Here, my command
\documentclass[12pt,a4paper,reqno,openbib]{extreport}
\usepackage[a4paper,left=1.60in,right=1.0in,top=1.0in,bottom=1.2in,footskip=0.5in]{geometry}
\usepackage{tocbibind}
%------------------
\usepackage{titletoc}%% http://ctan.org/pkg/titletoc
\titlecontents*{chapter}% <section-type>
[0pt]% <left>
{}% <above-code>
{\bfseries\chaptername\ \thecontentslabel\quad}% <numbered-entry-format>
{}% <numberless-entry-format>
{\bfseries\hfill\contentspage}% <filler-page-format>
\begin{document}
\begin{center}
{\Large \bf{Abstract}}
\end{center}
\addcontentsline{toc}{chapter*}{\noindent\text{Abstract}\hspace{12.5cm} }
\bigskip
\begin{center}
{\Large \bf{Abstrak}}
\end{center}
\addcontentsline{toc}{chapter*}{\noindent\text{Abstrak}\hspace{12.8cm}}
\bigskip
\begin{center}
{\Large \bf{Acknowledgment}}
\end{center}
\addcontentsline{toc}{chapter*}{\noindent\text{Acknowledgement}\hspace{11.0cm}}
\bigskip
\tableofcontents
\newpage
\listoffigures
\newpage
\listoftables
\newpage
%\newpage
\chapter{Chapter 1}
\section{Background of the study}
\chapter{Chapter2}
\section{Background of the study}
\end{document}
The output is:
Please find the attachment showing answers of your query.

Vertically centering a title page

I'm trying to vertically center a title on a custom-sized page with latex. I've written the following code, but for some reason it doesn't center. Could someone please point me to what's wrong with it?
Thanks!
\documentclass{article}
\setlength{\pdfpagewidth}{88.184mm}
\setlength{\pdfpageheight}{113.854mm}
\usepackage[margin=0.5cm, paperwidth=88.184mm, paperheight=113.854mm]{geometry}
\title{[[title]]}
\date{[[date]]}
\author{[[author]]}
\begin{document}
\vspace{\fill}
\maketitle
\vspace{\fill}
\newpage
[[text]]
\end{document}
There are two small bugs in your code.
First, if you want the \vspace to work at the beginning or end of a page, you should use the starred version (\vspace*).
This would work, but \maketitle is a pretty complicated macro, and if used like in your example, it just puts the title at the second page. You can use the titlepage environment, which gives you much more command over how the title page looks like -- including the spacing. For example, you could use the following code:
\documentclass{article}
\setlength{\pdfpagewidth}{88.184mm}
\setlength{\pdfpageheight}{113.854mm}
\usepackage[margin=0.5cm, paperwidth=88.184mm, paperheight=113.854mm]{geometry}
\begin{document}
\begin{titlepage}
\vspace*{\fill}
\begin{center}
{Huge [[title]]}\\[0.5cm]
{Large [[author}\\[0.4cm]
[[date]]
\end{center}
\vspace*{\fill}
\end{titlepage}
[[text]]
\end{document}
\null % Empty line
\nointerlineskip % No skip for prev line
\vfill
\let\snewpage \newpage
\let\newpage \relax
\maketitle
\let \newpage \snewpage
\vfill
\break % page break
If you want to make everything work even with \maketitle put your \vspace*{\fill} inside the first and the last attribute, exp:
\title{**\vspace*{\fill}**[[title]]}
\date{[[date]]}
\author{[[author]]**\vspace*{\fill}**[[}
\begin{document}
\maketitle
\newpage
[[text]]
\end{document}
As in the answer by finrod, \maketitle is a pretty complicated macro, this is why I didn't feel like overwriting it myself (\renewcommand\maketitle{...). Nevertheless, copying, pasting and editing lines 170-201 of article.cls documentclass, I could add a new one to customize (\newcommand\mymaketitle{...) as follows:
\documentclass{article}
\setlength{\pdfpagewidth}{88.184mm}
\setlength{\pdfpageheight}{113.854mm}
\usepackage[margin=0.5cm, paperwidth=88.184mm, paperheight=113.854mm]{geometry}
\title{Title}
\date{Date}
\author{Author}
\makeatletter
\newcommand\mymaketitle{%
\begin{titlepage}
\null\vfil\vskip 40\p#
\begin{center}
{\LARGE \#title \par}
\vskip 2.5em
{\large \lineskip .75em \#author \par}
\vskip 1.5em
{\large \#date \par}
\end{center}\par
\#thanks
\vfil\null
\end{titlepage}
}
\makeatother
\begin{document}
\mymaketitle
Text
\end{document}
The output:

Resources