I am triying to write my thesis in Latex. I want to create a title page. In my title page i have some space with the texts. I tried to give it with \vspace but it works between text not from top of the page. Can you suppose me a way to do this?
5 Answers
In order to add space at the top of the page you have to say
\vspace*{3cm}
because the simple \vspace is removed at page breaks.
If you want precise positioning with respect to the page margins, you can use textpos. For instance
\documentclass{book}
\usepackage{textpos}
\newcommand{\fromtop}[1]{%
\dimexpr-1in-\topskip-\topmargin-\headheight-\headsep+#1\relax
}
\newcommand{\fromleft}[1]{%
\dimexpr-1in-\oddsidemargin+#1\relax
}
\begin{document}
\begin{titlepage}
\setlength{\parindent}{0pt}
\begin{textblock*}{0pt}(\fromleft{2cm},\fromtop{3cm})
\makebox[0pt][l]{Text at the top}
\end{textblock*}
\begin{textblock*}{\textwidth}(\fromleft{5cm},\fromtop{6.5cm})
\makebox[0pt][l]{Text in the middle}
\end{textblock*}
\begin{textblock*}{\textwidth}(\fromleft{3cm},\fromtop{9.5cm})
\makebox[0pt][l]{Text at the bottom}
\end{textblock*}
\end{titlepage}
\end{document}
Another example, for centering the texts with respect to the page borders:
\documentclass{book}
\usepackage{textpos}
\newcommand{\fromtop}[1]{%
\dimexpr-1in-\topskip-\topmargin-\headheight-\headsep+#1\relax
}
\newcommand{\fromleft}[1]{%
\dimexpr-1in-\oddsidemargin+#1\relax
}
\begin{document}
\begin{titlepage}
\setlength{\parindent}{0pt}
\begin{textblock*}{\paperwidth}(\fromleft{0cm},\fromtop{3cm})
\centering
Text at the top
\end{textblock*}
\begin{textblock*}{\paperwidth}(\fromleft{0cm},\fromtop{6.5cm})
\centering
Text in the middle\\
with new line
\end{textblock*}
\begin{textblock*}{\paperwidth}(\fromleft{0cm},\fromtop{9.5cm})
\centering
Text at the bottom\\
with new line
\end{textblock*}
\end{titlepage}
\end{document}
- 1,121,712
-
1while true, this only takes care of positioning the first line. – barbara beeton Jan 09 '16 at 19:11
-
@barbarabeeton You're right. I have added a full solution, which does positioning with respect to the page borders, contrary to all others that have been presented. – egreg Jan 09 '16 at 20:42
-
I try this. But i cant unerstand how can i insert a new line in one block. For example text \ text \ text . 3 text is in same block but the one under the other. And also how can i make it center position – Cengiz Görkem DENGİZ Jan 09 '16 at 22:18
-
@CengizGörkemDENGİZ Your question didn't have those details. I added another example – egreg Jan 09 '16 at 22:25
-
Thank you for your answer this also solved problem. And two more question. Can i include pragraph indent in this block. And can i change text width and line spacing for only one block. – Cengiz Görkem DENGİZ Jan 09 '16 at 23:05
-
@CengizGörkemDENGİZ The site doesn't work like this. Please, ask a new question with the code you're using and show where your problems are. – egreg Jan 09 '16 at 23:06
I find tikzpagenodes to be perfect for laying out title pages. Note, you need to run this twice.
\documentclass{article}
\usepackage{tikzpagenodes}
\usetikzlibrary{calc}
\usepackage{mwe}
\begin{document}
\thispagestyle{empty}% I assume you don't want a page number
\begin{tikzpicture}[remember picture,overlay]
\draw[red] (current page text area.south west) rectangle (current page text area.north east);
\node[below,inner sep=0pt,text width=\textwidth] at ($(current page.north)+(0,-3cm)$)
{Notice that 3 cm is actually above the text area.};
\node[below,inner sep=0pt,text width=\textwidth] at ($(current page.north)+(0,-6.5cm)$)
{This should be 6.5 cm below the top of the page.};
\node[below,inner sep=0pt,text width=\textwidth] at ($(current page.north)+(0,-9.5cm)$)
{This should be 9.5 cm below the top of the page.};
\end{tikzpicture}
\newpage
\end{document}
- 79,712
- 3
- 50
- 120
The accepted answer is overcomplicated and with one potential bug. Try to write "Plus text text text" instead "Text text text" and think about the error message:).
What you need is something like this:
\newenvironment{mytextbox}[1]
{\nointerlineskip \vbox to 0pt\bgroup\vskip#1\relax}
{\vss\egroup}
Note: you need not to allocate special box, you need not to correct the vertical positions when \nointerlineskip is used.
- 74,238
-
I fixed the missing
\relaxbug in mine, thanks I always forget those. It's especially annoying in cases like\advance\mycounter1\ifnum\mycounter<10\dosomething\fiwhere the test happens with the old value... – Hood Chatham Jan 09 '16 at 19:02
Try this:
\newbox\mybox
\newenvironment{mytextbox}[1]
{\vskip-\baselineskip\setbox\mybox=\vbox\bgroup\vskip#1\relax}
{\egroup\ht\mybox=0pt\box\mybox}
At the beginning of the environment it starts a box and puts the appropriate vertical space at the top of it. The body of the environment goes into the box, and then at the end it sets the height to zero and prints the box. You probably will need to end the page using \newpage.
Example:
\documentclass{article}
\newbox\mybox
\newenvironment{mytextbox}[1]
{\vskip-\baselineskip\setbox\mybox=\vbox\bgroup\vskip#1}
{\egroup\ht\mybox=0pt\box\mybox}
\begin{document}
\begin{mytextbox}{3cm}
Text text text Text text text Text text textText text textText text textText text text
Text text textText text text Text text textText text textText text text
\end{mytextbox}
\begin{mytextbox}{6.5cm}
Text text text Text text textText text textText text textText text textText text text
Text text text Text text textText text textText text text
\end{mytextbox}
\end{document}
Edit: Thanks to Wipet for catching a dumb mistake in my code. I recommend anyone who wants to use this environment to use Wipet's better answer further down on this page.
- 5,467
-
Yes it worked. Thank you! But when i try to second text for 0 cm it add a baselineskip. Can i type {-\baselineskip + 5cm} or else. – Cengiz Görkem DENGİZ Jan 09 '16 at 17:09
-
If you want to adjust everything up by a
\baselineskip, replace the second line of the environment definition with:{\setbox\mybox=\vbox\bgroup\vskip-\baselineskip\vskip#1}. On my computer, it seems that the space is slightly less than a\baselineskip. – Hood Chatham Jan 09 '16 at 17:10 -
If you try {0cm} for two textbox there are some space. So it is not top to top distance. – Cengiz Görkem DENGİZ Jan 09 '16 at 17:19
-
I see, so you need to say
{\vskip=-\baselineskip \setbox\mybox=\vbox\bgroup\vskip#1}. This makes it so that multiple 0pt boxes lie directly on top of each other. – Hood Chatham Jan 09 '16 at 17:24 -
-
One more question. Can i include a picture in this text box left of the text? – Cengiz Görkem DENGİZ Jan 09 '16 at 18:26
-
You should use wipet's answer, it's the same idea as mine but better written. – Hood Chatham Jan 09 '16 at 19:04
\documentclass{article}
\newbox\mybox
\newenvironment{mytextbox}[1]
{\vskip-\baselineskip\setbox\mybox=\vbox\bgroup\vskip#1}
{\egroup\ht\mybox=0pt\box\mybox}
\begin{document}
\begin{titlepage}
\begin{center}
\begin{mytextbox}{0.5cm}
\textbf{asdf\\
asdf ÜNİVERSİTESİ\\
FEN BİLİMLERİ ENSTİTÜSÜ}
\end{mytextbox}
\begin{mytextbox}{4cm}
\textbf{asdgd ANABİLİM DALI}
\end{mytextbox}
\begin{mytextbox}{7cm}
\textbf{adfhdsh}
\end{mytextbox}
\begin{mytextbox}{12.5cm}
\textbf{DOKTORA TEZİ}\\
\end{mytextbox}
\begin{mytextbox}{13.5cm}
\textbf{asfsdgd}\\
\textbf{124235}
\end{mytextbox}
\begin{mytextbox}{17cm}
\textbf{Tezin Savunma Tarihi: 00.00.0000}
\end{mytextbox}
\begin{mytextbox}{20.5cm}
\textbf{Tez Danışmanı: asgsdggf}
\end{mytextbox}
\end{center}
\begin{mytextbox}{24cm}
Bu Yüksek Lisans/Doktora Tez Çalışması sagfdfhgdh Üniversitesi………………’nolu Proje ile desteklenmiştir.
\end{mytextbox}
\end{titlepage}
\end{document}
I typed this command and it worked. I dont understand wipet answer.
-
2The answer is low-quality. All you did was grab the definition of the accepted answer and included it in your use-case. It's adding unnecessary clutter to this post. – Werner Jan 09 '16 at 19:30




\vspacewhere needed. – barbara beeton Jan 09 '16 at 16:31