Simple questions on fonts and how to center vertically
Hi,
I would like to create a document where the first page contains a title
and a subtitle. The title would be in bold face, and the subtitle in
italics. The font size would be something bigger than 12 points and
those would be centered vertically on the page (with a bit of space
between them).
After some readings, I came up with the following solution:
% ------------------------------------------------------------------
\font\titlefont=cmbx12 scaled\magstep3
% Header
\setupheadertexts[\vbox{
\ifodd\pagenumber
\hfil{\sc{a Title}}\hfil\hfil\pagenumber\hfil
\else
\hfil\pagenumber\hfil\hfil{\sc{author}}\hfil
\fi
\break
\vbox{\hfil\hrulefill\hfil}
}]
% Start front page
\eject\nobreak\vfill
% Title
{\titlefont
\centerline{a Title}
\vskip 1em
}
\vfil % Leave some space between
% Subtitle
{\titlefont\it
\centerline{a Subtitle}
\vskip 1em
}
% Stop Front Page
\nobreak\vfill\eject
\end
% ------------------------------------------------------------------
The problems are:
* It is not centered vertically
* The subtitle is not as big as I would have expected
* There is not enough space between the title and the subtitle
Can you come up with a better solution?
Ideally, I would like to have the font size changed in a way so the
control sequences like \it, \bf ... continue to work as expected.
Something I could use like:
{Some normal text \magnify{3} three times magnified text \it the same
size in italics \bf Three times magnified, bold and italics \dots}
It seems I also have troubles getting the TeX box model right.
Previously, I tried to create a ruler below the ruler and it took me
time to figure out how to display it. Naive implementation seamed not
to work. Especially, i don't understand why the \hfil\hrulefill\hfil
should be inserted in a \vbox.
Is there some documentation somewhere explaining that?
Thanks.
Mildred
--
Mildred Ki'Lya
╭───────── mildred593@online.fr ──────────
│ Jabber, GoogleTalk:
Am 16.11.2008 um 11:48 schrieb Mildred Ki'Lya:
Hi,
I would like to create a document where the first page contains a title and a subtitle. The title would be in bold face, and the subtitle in italics. The font size would be something bigger than 12 points and those would be centered vertically on the page (with a bit of space between them).
After some readings, I came up with the following solution:
You should use ConTeXt markup and try to avoid the plain TeX commands.
% ------------------------------------------------------------------
\font\titlefont=cmbx12 scaled\magstep3
Don't do this, use ConTeXts font commands, Aditya Mahajan wrote a nice article about them, if you want to print it use the TuGboat version. http://wiki.contextgarden.net/Font_Switching
% Header \setupheadertexts[\vbox{ \ifodd\pagenumber \hfil{\sc{a Title}}\hfil\hfil\pagenumber\hfil \else \hfil\pagenumber\hfil\hfil{\sc{author}}\hfil \fi \break \vbox{\hfil\hrulefill\hfil} }]
\startsetups header:right \line{\hfil{\sc a Title}\hfil\hfil\pagenumber\hfil} \stopsetups \startsetups header:left \line{\hfil\pagenumber\hfil\hfil{\sc author}\hfil} \stopsetups % Line below the header, you can more solutions in the mail archive \setupheader[text][after=\hrule] % header content: alternative a \setuppagenumbering[location=,alternative=doublesided] \setupheadertexts[\setups{header:right}][][][\setups{header:left}] % header content: alternative b \setuppagenumbering[location=] \setupheadertexts[\doifoddpageelse{\setups{header:right}} {\setups{header:left}}] \starttext
% Start front page \eject\nobreak\vfill
% Title {\titlefont \centerline{a Title} \vskip 1em }
\vfil % Leave some space between
% Subtitle {\titlefont\it \centerline{a Subtitle} \vskip 1em }
% Stop Front Page \nobreak\vfill\eject
\startstandardmakeup[align=middle] {\definedfont[SansBold sa \magfactor{1}]a Title} \blank[2cm] {\definedfont[SansBoldItalic sa \magfactor{1}]a Subtitle} \stopstandardmakeup
\end
\stoptext
% ------------------------------------------------------------------
The problems are: * It is not centered vertically * The subtitle is not as big as I would have expected * There is not enough space between the title and the subtitle
Can you come up with a better solution?
Ideally, I would like to have the font size changed in a way so the control sequences like \it, \bf ... continue to work as expected.
\switchtobodyfont[xxpt]\it
Something I could use like:
{Some normal text \magnify{3} three times magnified text \it the same size in italics \bf Three times magnified, bold and italics \dots}
It seems I also have troubles getting the TeX box model right. Previously, I tried to create a ruler below the ruler and it took me time to figure out how to display it. Naive implementation seamed not to work. Especially, i don't understand why the \hfil\hrulefill\hfil should be inserted in a \vbox.
Is there some documentation somewhere explaining that?
http://context.aanhet.net/svn/contextman/context-reference/en/co-fonts.pdf http://context.aanhet.net/svn/contextman/context-reference/en/co-typography.... Wolfgang
Le Sun 16/11/2008 à 13:01 Wolfgang Schuster à écrit:
You should use ConTeXt markup and try to avoid the plain TeX commands.
Thank you for your hists. I'll have to go through them.
In fact, I wanted as much as possible to be independent from ConTeXt
itself. In the file I typeset, I only use customized control sequences
I have defined before. It looks like:
\def\title{Title}
\def\author{Author}
\Header{
\ifodd\pagenumber
\hfil{\sc\title}\hfil\hfil\pagenumber\hfil
\else
\hfil\pagenumber\hfil\hfil{\sc\author}\hfil
\fi
\break
\vbox{\hfil\hrulefill\hfil}
}
\PaperSize{C5}
\StartFrontPage
\Title{\title}
\vfil
\SubTitle{\author}
\StopFrontPage
\Chapter
\Title{Introduction}
\Chapter[1]
\Title{Chapter name}
All those control sequences are defined in another file I \input at the
beginning. This way, I can be independent from the TeX's flavour I use.
In fact, I started hating TeX (it was more LaTeX I think) because I
couldn't customize it as i wanted. I could write styles, but it was
over complicated and there was no documentation I could find.
Recently, I realized that TeX wasn't so bad. Before that, I had tried to
write TeX replacements, but I have realized then that TeX has
everything I wanted (except perhaps unicode support that luatex is
supposed to have now). It just lacked proper documentation. I decided
it was not a sufficient reason to start an alternative to TeX so I
started using TeX.
At first, I wanted to use LuaTeX (because I like Lua a lot and I need
unicode). The main problem I had was it was impossible for me to get
unicode characters right. So I switched to ConTeXt (which still used
LuaTeX but was able to display unicode as well). I still plan to
eventually move to LuaTeX when it will recognize unicode characters.
That's why I don't want to use too many ConTeXt advanced features. The
other reasons being that I want to learn low-level TeX, so perhaps one
day, I'll be able to write documentation for all those like me who like
to understand every single bit of the language they use. I don't like
having recipes I just have to apply, I want to be able to understand
what's behind.
Thanks :)
Mildred
--
Mildred Ki'Lya
╭───────── mildred593@online.fr ──────────
│ Jabber, GoogleTalk:
Am 16.11.2008 um 14:36 schrieb Mildred Ki'Lya:
Le Sun 16/11/2008 à 13:01 Wolfgang Schuster à écrit:
You should use ConTeXt markup and try to avoid the plain TeX commands.
Thank you for your hists. I'll have to go through them.
In fact, I wanted as much as possible to be independent from ConTeXt itself. In the file I typeset, I only use customized control sequences I have defined before. It looks like:
Ah! You try to define your own markup for TeX.
\def\title{Title} \def\author{Author}
\Header{ \ifodd\pagenumber \hfil{\sc\title}\hfil\hfil\pagenumber\hfil \else \hfil\pagenumber\hfil\hfil{\sc\author}\hfil \fi \break \vbox{\hfil\hrulefill\hfil} }
Better: \Header{\sc\title\\\pagenumber}{\pagenumber\\sc\author} and the mapping to the ConTeXt commands happens in your style file.
\PaperSize{C5}
\StartFrontPage \Title{\title} \vfil \SubTitle{\author} \StopFrontPage
Why do you use a environmen but post low level code in your other mail, if you use such code use it in your questions, it's easier to help you.
\Chapter \Title{Introduction}
\Chapter[1] \Title{Chapter name}
What is \Chapter supposed to do.
All those control sequences are defined in another file I \input at the beginning. This way, I can be independent from the TeX's flavour I use.
In fact, I started hating TeX (it was more LaTeX I think) because I couldn't customize it as i wanted. I could write styles, but it was over complicated and there was no documentation I could find.
Recently, I realized that TeX wasn't so bad. Before that, I had tried to write TeX replacements, but I have realized then that TeX has everything I wanted (except perhaps unicode support that luatex is supposed to have now). It just lacked proper documentation. I decided it was not a sufficient reason to start an alternative to TeX so I started using TeX.
At first, I wanted to use LuaTeX (because I like Lua a lot and I need unicode). The main problem I had was it was impossible for me to get unicode characters right. So I switched to ConTeXt (which still used LuaTeX but was able to display unicode as well). I still plan to eventually move to LuaTeX when it will recognize unicode characters.
That's why I don't want to use too many ConTeXt advanced features. The other reasons being that I want to learn low-level TeX, so perhaps one day, I'll be able to write documentation for all those like me who like to understand every single bit of the language they use. I don't like having recipes I just have to apply, I want to be able to understand what's behind.
You could also use xml for your document, it's independant of the backend and you could use whatever you want to produce a pdf file. Or you write a complete new markup style, here is something from my archive, I never used it but it was interesting to test a new method to write text. [ :document [ :title {Document title} [ :section "Section title" [ :example [ :sign {Name} My name is :sign {Name}. I live in :sign {town}. ] ] [ :description {xxx} [We all know xxx is known for ...] ] ] ]] Regards, Wolfgang
Le Sun 16/11/2008 à 15:12 Wolfgang Schuster à écrit:
Am 16.11.2008 um 14:36 schrieb Mildred Ki'Lya:
Le Sun 16/11/2008 à 13:01 Wolfgang Schuster à écrit:
You should use ConTeXt markup and try to avoid the plain TeX commands.
Thank you for your hists. I'll have to go through them.
In fact, I wanted as much as possible to be independent from ConTeXt itself. In the file I typeset, I only use customized control sequences I have defined before. It looks like:
Ah! You try to define your own markup for TeX.
Better:
\Header{\sc\title\\\pagenumber}{\pagenumber\\sc\author}
and the mapping to the ConTeXt commands happens in your style file.
Well, I still prefer my code as it is more flexible and you can share bits of code between the two headers (in my case, the ruler)
\PaperSize{C5}
\StartFrontPage \Title{\title} \vfil \SubTitle{\author} \StopFrontPage
Why do you use a environmen but post low level code in your other mail, if you use such code use it in your questions, it's easier to help you.
Well, it was to simplify ... If I hadn't, I would have post this code plus the definitions before it, making it necessary for the readers to look up for the definition each time.
\Chapter \Title{Introduction}
\Chapter[1] \Title{Chapter name}
What is \Chapter supposed to do.
\Chapter is supposed to create a page break. If there is a number, it should display \Title{Chapter #1}. The \Title macro just makes the following text larger, centered on the line and add a bit of space below. It looks like: \font\titlefont=cmbx12 scaled\magstep3 \font\subtitlefont=cmbx12 scaled\magstep5 \parindent=20pt \def\DropCaps#1{% \DroppedCaps{}{cmr10}{2\baselineskip}{2pt}{1\baselineskip}{2} #1} \def\PaperSize#1{ \setuppapersize[#1][#1] } \def\StartFrontPage{% \eject\nobreak\vfill% } \def\StopFrontPage{% \nobreak\vfill\eject% } \def\Title#1{% {\titlefont% \centerline{#1}% \vskip 1em% }} \def\SubTitle#1{% {\it% \centerline{#1}% \vskip 1em% }} \def\doChapter[#1]{% \vfill\eject{}% \iffirstargument% \Title{Chapter #1}% \fi% } \def\Chapter{\dosingleempty\doChapter} \def\Header#1{\setupheadertexts[\vbox{#1}]} \def\Footer#1{\setupfootertexts[\vbox{#1}]} \def\End{\end}
That's why I don't want to use too many ConTeXt advanced features. The other reasons being that I want to learn low-level TeX, so perhaps one day, I'll be able to write documentation for all those like me who like to understand every single bit of the language they use. I don't like having recipes I just have to apply, I want to be able to understand what's behind.
You could also use xml for your document, it's independant of the backend and you could use whatever you want to produce a pdf file.
I have tried before. Using XSLT to transform my document to an XSL-FO document, rendered using Apache FOP. The fact is that XML is awful to write in a classic text editor. It seems that good XML editors requires you to pay for it (and you don't have the source). Moreover, you often need to give it the DTD or XML Schema.
Or you write a complete new markup style, here is something from my archive, I never used it but it was interesting to test a new method to write text.
In fact, I'm quite comfortable with TeX markup. I would probably have
replaced the \ character with another one (on french keyboards, it's
not as easily typed. Fortunately on French macintosh keyboards it's a
bit easier). But overall, I like the syntax.
Thanks.
Mildred
--
Mildred Ki'Lya
╭───────── mildred593@online.fr ──────────
│ Jabber, GoogleTalk:
Hello Mildred, It sounds like you're trying to reinvent the wheel, and I can understand your desire for it (although I don't share it at all); but it also sounds like you haven't looked deep enough into the existing tools:
I still plan to eventually move to LuaTeX when it will recognize unicode characters.
LuaTeX interprets its input as UTF-8 byte sequences, and handles characters by their Unicode code point internally. Thus, it does recognize Unicode characters perfectly well; you seem to be expecting something more, but you should describe it more precisely (and maybe not on this list).
The other reasons being that I want to learn low-level TeX
If you want that, you should start by reading the TeX book and the LuaTeX reference, which are perfectly well documented. There is simply no way out. Arthur
participants (3)
-
Arthur Reutenauer
-
Mildred Ki'Lya
-
Wolfgang Schuster