Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Can someone tell me how to create boxes around the title of my PDF? I'm thinking about something like this:

enter image description here

where I can write stuff around the title (which is "test test...").

share|improve this question
add comment

1 Answer

up vote 8 down vote accepted

I'm pretty sure that the font formatting options contains some basic mistakes but here is an attempt to make simple title page.

\documentclass{article}
\usepackage{tikz}
\begin{document}
\vspace*{30mm}
\thispagestyle{empty}
\begin{center}
\begin{tikzpicture}
\node[align=center,draw,thick,minimum width=\textwidth,inner sep=6mm] (titlebox)%
{\textsc{\large Mathematical Minutae}\\[\baselineskip]\textbf{\huge Test Test Test Test}};
\node[fill=white] (W) at (titlebox.north) {\bfseries \Huge W};
\node (feat) at ([yshift=9mm]titlebox.north) {\textsc{\Large Feature}};
\end{tikzpicture}
\end{center}
\end{document}

which gives: enter image description here

I didn't understand quite the last sentence in which you wrote around the title, but I hope I got it right.

By the way, I would like to mention whenever I can that I am looking forward to the highly anticipated work of Altermundus, pgfvectorian package, on carrying ornaments of psvectorian goodies to TikZ/PGF, (I think it is a wonderful attempt to even consider it). So we can even put more beautiful stuff instead of plain boxes (not that it is ugly but it's always to have moar options).

EDIT A simple macro to have some more automation

\documentclass{article}
\usepackage{tikz}
\newcommand{\titlebox}[1]{%
\begin{center}
\begin{tikzpicture}
\node[align=center,draw,thick,text width=\textwidth,inner sep=6mm] (titlebox)%
{\textsc{\large Mathematical Minutae}\\[\baselineskip]\textbf{\huge #1}};
\node[fill=white] (W) at (titlebox.north) {\bfseries \Huge W};
\node (feat) at ([yshift=9mm]titlebox.north) {\textsc{\Large Feature}};
\end{tikzpicture}
\end{center}
}
\begin{document}

\vspace*{30mm}% This introduces some space you can remove or change it.
\titlebox{My title test is a test that tests \\ my title} % An example use

\end{document}
share|improve this answer
    
Excellent; that was exactly what I was looking for. Thanks a lot. I still have a question though: could you tell me how to place this beautiful box around the title (meaning the exact place where the text "Test test" would appear if I used \title{Test test})? I have no clue how to use tikz (I thought that there would be ready-made boxes to put around the title), so I couldn't figure out how to manipulate your code to change the coordinates to put the picture so that "Test test..." is where the title would be.... –  user10324 Feb 24 '12 at 20:06
    
@user10324 Ah, I hope I now see what you mean. You want to provide the option and the title is printed automatically. Well, as it is, you can simply find and modify the Test Test Test part in the code without actually requiring to use the \title{} command and carry on with what you would like to have for the rest of the document. I will try to update this when I come up with a simpler macro. Can you tell me once again for the sake of confirmation exactly which part is going to be positioned and what needs to be changed? –  percusse Feb 24 '12 at 20:11
    
The place in the box, where "Test test..." is written, is where the title should be. To confirm: What I wanted was a hypothetical command '\titlebox{Test test}', that should create a box like above around the title "Test test" (meaning "Test test" is placed where /title{Test test} would place it; or differently: After using '\titlebox{Test test}', using the command /title{Test test} shouldn't visually change anything). –  user10324 Feb 25 '12 at 8:49
    
I played around with your code an could change the "Test test..." myself, just by editing the appropriate line of code. What I couldn't change though is the location of the whole box in the page: It is centered, but I higher up on the page, so that, like in my previous comment described, the "Test test" string from the box should be where \Title{Test test} would place it. If I only could move that box higher, my problem would be solved. Doing a macro would of course be even nicer, but maybe overkill, I think. –  user10324 Feb 25 '12 at 8:50
    
@user10324 See my edit. I think the comments are more informative now. –  percusse Feb 25 '12 at 10:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.