Prompted by a query from a fellow LyX-er who volunteered to do a club
newsletter, I thought I'd share my findings and experiences of the
joys and pitfalls of using LyX to produce a magazine-like publication.
A magazine is quite different to the default uses that LyX gets put to;
it isn't an article for a journal, nor is it a technical manual.
Therefore I had to resort to learning a bit of LaTeX and dotting ERT
here and there. I even wrote myself a class! (Actually, two of them)
But this is all done from a LyX perspective, not from a LaTeX one: the
LaTeX I learned was bits and pieces. Others may not need to do half the
ERT I did, because their needs won't be quite the same as I had for my
fiction magazine. (Well, it's a fanzine, not anything professional!)
What I needed:
1) a mixture of one and two-column format
2) table of contents and title together on the first page
3) lots of included graphics which were bitmap rather than vector
graphics (illustrations, not diagrams)
4) said pictures needed to be varying sizes and placed where I wanted
5) fancy page headers and footers
6) a compact format, fitting in a fair amount of text while still
looking good
7) Story titles without "Chapter" naming or numbers
8) non-standard table of contents (Story-Title by Author)
9) Story titles in fancy fonts
10) Story titles as images
11) Poetry in calligraphic font
12) fancy scene-separators in stories
13) produce a list of illustrations, by illustrator
14) to be able to produce good PDF format
15) to be able to produce PDF format in small enough chunks to be
downloaded from a web page
The solutions I found are probably quite inelegant, but they worked well
enough. See the result at
<http://www.katspace.com/fiction/stakedb7.shtml>
I am using RedHat 7.1 Linux, with the standard teTeX installation which
comes with that. When I started I was using LyX 1.1.6fix1, but now am
using version 1.1.6fix2.
The solutions:
1) a mixture of one and two-column format
My first attempt was to use \twocolumn and \onecolumn, since I wanted
one-column pages for the table of contents and editorial, and two-column
pages for the stories. I wanted the story titles to be the whole width
of the page, and I thought I could do that by making them a wide float.
Unfortunately, even with the H option of the "float" package, all I
ended up with was the title at the top of the next page, or no title at
all. (*)
So I used the multicol package.
This requires the use of ERT at the start end end of each group of
two-columns, but it works.
----------------------
(*) Of course, as fate would have it, *today* I found out that
\twocolumn has an optional argument that might have solved my problem...
----------------------
2) table of contents and title together on the first page
I originally was using the report document class (and as I said, ended
up writing my own class) but that put the table of contents on a
separate page of its own, so I ended up making my "fanzine" class based
on the "article" class instead.
This is the start of my fanzine.cls file:
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{fanzine}[2001/06/03
Fanzine customization package
: Kathryn Andersen]
%%
%% based on Article
%% I chose Article because Chapters in reports always started on a new page.
%% Even the table of contents.
%%
%% Force this to be two-sided ten point.
\DeclareOption{oneside}{\OptionNotNeeded}
\DeclareOption{11pt}{\OptionNotNeeded}
\DeclareOption{12pt}{\OptionNotNeeded}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions
\LoadClass[10pt,twoside]{article}
(so I'm basically forcing it to be 10pt and two-sided)
3) lots of included graphics which were bitmap rather than vector
graphics (illustrations, not diagrams)
So of course one needs to use the graphics package.
If using bitmap graphics, it's best to have them in jpg and/or png
format (though if you aren't producing PDF it may be moot).
Keep the jpg and png files in the same directory as your lyx files,
and produce eps files from the originals. That way you can see your
picture in LyX, which you wouldn't be able to do if you used the
"include external materials" command.
I used gimp to produce the EPS files from the png files.
One can also use the "convert" program from the ImageMagick suite.
For the Jpeg files, there's a program one can download from CTAN
<http://www.ctan.org> called jpeg2ps, which gives you a much better
result for your EPS files than convert does; it takes advantage of the
fact that Level 2 Postscript understands about Jpeg, and keeps your jpeg
info intact, merely adding extra info to help Postscript understand it.
This results in much smaller EPS files.
Also, because these are illustrations, not figures, I had to figure out
(no pun intended) how to *not* have those wretched Figure: captions on
them. It wasn't that difficult:
a) include float
You then get that Figure: thing inside the float box
b) the style box has Caption in it. Change that to Standard.
The "Figure:" bit dissappears!
Then you can include your "figure".
4) said pictures needed to be varying sizes and placed where I wanted
This is actually two problems. The first problem was that pictures
would go onto float pages by themselves when I didn't want them to;
they'd be displaced if they were anything bigger than 50% of the page
length!
So this is what went in my class file:
%% fix up float positioning
%% -- enable pictures to be at the bottom of the page
%% -- enable pictures to take up more space without being
%% floated to their own float page
\renewcommand{\topfraction}{.95}
\renewcommand{\dbltopfraction}{.95}
\renewcommand{\bottomfraction}{.7}
\renewcommand{\textfraction}{.05}
\renewcommand{\floatpagefraction}{.8}
\renewcommand{\dbltopfraction}{.95}
\renewcommand{\dblfloatpagefraction}{.8}
This basically means that a picture won't be stuck on a float-page
unless it's 80% of the page height.
The other factor was, with my original layout, I was able to make
pictures, say, be 2/3 of the page width and have the text wrap around
them. In two columns.
Unfortunately, I have not found a way to do it with LyX/LaTeX.
The floatflt package does allow text to wrap around your figures, but
with limitations. There are also limitations imposed by the multicol
package as well. So with your figures you have three choices:
a) Use a wide figure float, making it the width of the page.
You can make the actual picture smaller than the width of the page, but
it will then have white space around it, which can look okay so long as
there isn't too much of it.
b) use a non-floating figure inserted into the text directly, which is
exactly the width of the column. This means you have to position it
yourself, it won't be nicely floated for you. Unfortunately, the
multicol package won't allow you to have non-wide floats. If you put
them in, they never appear in the output.
c) figures wider than a column and less wide than a page, *can* have
text wrapped around them (use the fltfloat package) *if* you are in
one-column mode. So, again, this requires you to work things out for
yourself, so you can decide when to switch from two-column to one-column
mode (and back again). Again, losing the advantage of letting LaTeX do
the work for you. But sometimes ya gotta...
5) fancy page headers and footers
I used the fancyhdr package. I never did end up putting graphical
objects around my page-numbers though.
Read the documentation for the fancyhdr package, it's got a lot of info
about page layout.
6) a compact format, fitting in a fair amount of text while still
looking good
In the Document Layout, I used the geometry package, set narrow margins,
and made the header and footer space smaller as well.
One wierd thing, though: I set the Left margin to be 2.5cm, and the
Right margin to be 1.7cm... and when I get the result, the inner margin
is 3cm wide, and the outer margin is 1cm wide. It isn't an odd offset
thing, because it happens on both odd and even pages. That is, on an
odd page, the left margin is 3cm and the right margin is 1cm, and on an
even page, the left margin is 1cm and the right margin is 3cm. I have
no idea why it did that.
In regard to the columns, I've found in the past, that making a 6mm gap
between the two columns makes it more readable (I don't know what the
default is with LaTeX, but I've found other programs make it too
narrow).
%% multi-columns
\setlength{\columnsep}{6mm}
7) Story titles without "Chapter" naming or numbers
Document Layout -> Extra
Section number depth -2
Table of contents depth 2
(I actually made myself a lyx layout class for Fanzine which
set this as a default).
That was only one half of the solution: I still had to change the
definitions of sectioning commands so that it wasn't trying to put
things like "Chapter" on there. For this I used the titlesec package
(other packages I tried first didn't quite do) with the [nops] option
(because I was using the fancyhdr package for the page headers and
footers).
Here's the section from fanzine.cls:
(assuming I have earlier defined the \fzhdrfamily for using a fancy
font, see below)
%% Section -- no label, centred block in the header font
\titleformat{\section}[block]
{\fzhdrfamily\Huge\bfseries\filcenter}{}{0pt}{}
\titlespacing*{\section}{0pt}{1pt}{2pt}
%% SubSection -- no label, centred block in the header font
\titleformat{\subsection}[block]
{\fzhdrfamily\Large\bfseries\filcenter}{}{0pt}{}
\titlespacing*{\subsection}{0pt}{5pt}{2pt}
8) non-standard table of contents (Story-Title by Author)
After trying a few different things out, I used the titletoc package
(rather than the tocloft package) because it gave more control over
things.
This was how I defined my Section and SubSection table-of-contents
entries:
%% Section TOC -- no label, no indent, line of dots
\titlecontents{section}[0pt]{}
{}
{\hspace*{2.3em}}
{\bfseries\titlerule*[5pt]{.}\contentspage}
%% SubSection TOC -- no label, line of dots
\titlecontents{subsection}[1.5em]{}
{}
{\hspace*{2.3em}}
{\bfseries\titlerule*[5pt]{.}\contentspage}
The other thing was, I wanted things in the table-of-contents
that weren't in the actual header; rather than having just the title, I
wanted the title and author. So I made some new commands of my own:
% format the TOC entry
\newcommand{\sbtocentry}[2]{%
{\bfseries #1} by \textsc{#2}
}
% add story to TOC
\newcommand\sbaddplainstory[2]{
\thispagestyle{plain}% force first page to have no header
\section[{\sbtocentry{#1}{#2}}]{#1}
% "short" form has Title + Author, "long" form has Title only
\chead{\large\texthdr{#1}}% set the header at the same time
}
(\texthdr was defined to use one of the fancy fonts, to be used in
page headers and footers, see below)
9) Story titles in fancy fonts
I have alluded above as to how I put the fancy fonts into the section
definitions.
That was the easy part -- relatively easy, that is. But I did that
second. The first part was getting the fancy fonts. A saga.
All I can say is, even though one is supposed to be able to use TrueType
fonts with TeX, I couldn't get it to work. X-Windows had no problem
with them, Ghostscript had no problem with them -- all I had to do was
tell them what directories to look in, and construct one simple file
(which I ended up writing a small script to do)... but TeX! In the end
I gave up and converted selected fonts into Type1 (Postscript) fonts,
and used vfontinstall (which I can't remember how I tracked down,
actually) to install the resultant fonts.
In tracking down How-To-Install-Fonts-Into-TeX information, I was
mightily confused by the seemingly constant reference to the program
ttf2tfm -- which didn't exist on my system. It apparently comes with
MikTex, but I have teTeX... which doesn't have it. It wasn't until a
friend pointed out that the beauty of Unix is pipes... yes, there are
indeed two commands which teTeX has, which if added together, do the
same thing as ttf2tfm: ttf2afm + afm2tfm
What I've actually ended up with is a bit of a hybrid: Ghostscript knows
about the TrueType fonts, but TeX knows about the Type1 fonts which were
constructed from them.
(after all, they're already installed in my
system, X-Windows knows about them, and Ghostscript (once I created the
relevant Fontmap file) knows about them already, so why install the
converted Type1 fonts again?)
Strangely enough, it seems to work.
There's an article on CTAN about How-To-Use-True-Type-Fonts-With-Tex
(which is really about How-To-Convert-True-Type-Fonts-And-Install-Them)
which was helpful, but I only did the first part, the conversion.
I can't remember where I tracked down the actual program used, sorry.
But CTAN is a good place to start. And http://www.google.com to do
searches.
The actual installation I did with vfontinstall (aka vfontinst)
which is a godsend for the quite complicated process of installing fonts
into TeX -- considering the demand that one rename all the files to fit
with Berry's font naming conventions... (a point slightly moot for me,
since (a) I'm not planning on exchanging LaTeX source with anyone, just
PDF files and (b) a lot of the fancy fonts I use are non-standard anyway)
However, vfontinst is still worth it, because, besides renaming the font
files for you, it creates the various different files, and moves them
into the right spots as well. I had to change some of the things it did
(fortunately it builds scripts do do each step of the process, so you
can change them before you call them) -- for example, make it do a
separate file for the font information rather than modifying the psfonts
file.
Fonts require research...
10) Story titles as images
What I wanted here was to be able to use a graphic *instead* of a title,
for the actual story-title, but still have it appear sensibly in the
table of contents. This was so that I could use interesting effects and
also not have to install every single TrueType font I had into TeX; if I
was only using that particular font once, for one title, it was not
worth the effort (particularly as some fonts simply wouldn't convert --
X-Windows liked them, but the conversions didn't).
This was a big challenge. I had to resort to a large amount of ERT,
rather than being able to use Section or Figure commands from LyX.
I ended up making my own command, as follows, with three arguments --
the title, the author, and the name of the file containing the
title-graphic. (And yes, there were two versions of the file -- the EPS
file and the PNG file)
This was the command:
\newcommand\sbaddstory[3]{
\thispagestyle{plain}% no page header first page
\section[{\sbtocentry{#1}{#2}}]% the "short form" has the info
{\resizebox*{1\textwidth}{!}{\includegraphics{#3}} }%
% the "long form" has the graphic
\chead{\large\texthdr{#1}}% set the page header with the title
}
I figured out what commands to use for the graphic by the expedient of
making a test file in LyX which had the graphic the way I wanted it, and
then exporting to LaTeX and seeing what the commands were.
Not having a copy of the LaTeX book at the time, that was what I was
reduced to...
Oh, and I forgot to mention, each story was in a separate file, and
included in a master file; therefore each new story started on a new
page.
11) Poetry in calligraphic font
First I had to import the caligraphic font (see above).
The Berry font name for this particular font ended up being "ome".
Then more ERT and more commands.
%% Fonts for poems -- Merlin font
\newcommand\fzpoemfamily{\usefont{T1}{ome}{m}{n}}
\DeclareTextFontCommand{\textpoem}{\fzpoemfamily}
%% a Poem environment
%% the argument is the size of the font
\newenvironment{fzpoem}[1]
{\fzpoemfamily #1}
{}
%% a Poem title
\DeclareTextFontCommand{\fzpoemtitle}
{\fzpoemfamily \Huge}
So, for the poem title I did ERT saying
\fzpoemtitle{Title}
(and more ERT adding it to the table of contents (there was another
command I had which was similar to the addplainstory one))
and then I did the poem in a Verse environment, and surrounded it with
ERT saying
\begin{fzpoem} and \end{fzpoem}
That gave me the poem in the caligraphic font (with its title in the
same font, rather than in the fancy Section-header font).
12) fancy scene-separators in stories
After all the messing about with fonts, this was relatively easy.
I just had to figure out what the name of the Zaph Dingbat font was,
and create the following commands:
% commands to select the Zaph Dingbat font
\newcommand\fzdingbatfamily{\usefont{U}{pzd}{m}{n}}
\DeclareTextFontCommand{\fzdingbat}{\fzdingbatfamily}
% generic separator
\newcommand{\fzsep}[1]{
\medskip{}
{\centering \large\fzdingbat{#1}\par}
\medskip{}
}
% large separator, laid out like a cross
\newcommand{\fzseplarge}[1]{
\medskip{}
{\centering \large\fzdingbat{#1}\par}
{\centering \large\fzdingbat{#1#1#1}\par}
{\centering \large\fzdingbat{#1}\par}
\medskip{}
}
Then one just had to decide which dingbat character to use as one's
separator. I made it generic because I have two different fanzines that
I do, and they have different styles of separator.
This is what I did for Staked Blake (the "v" gives a crossed diamond):
\newcommand{\sbsep}{
\fzsep{v}
}
\newcommand{\sbsepwide}{
\fzsep{vvv}
}
\newcommand{\sbseplarge}{
\fzseplarge{v}
}
Then at each scene break, ERT
\sbsep
and at the end of the story, either \sbsepwide or \sbseplarge
13) produce a list of illustrations, by illustrator
What I used to do (before LyX) was create this by hand -- I would print
out a version of the document, and make note of what page each
illustration was on, and then go back and write it into the table of
illustrators.
With LyX, I can use cross-references! Put a label next to each
illustration. Then, on the first page, create a table with two columns,
one containing the name of the illustrator, and the second column in
that row, containing Page references to the particular illustrations
that that person did. No tedious page-number-noting required!
This is one bit where LyX is definitely a plus.
14) to be able to produce good PDF format
Firstly, use the pslatex package, so that your default fonts are the
same as the PDF default fonts (that is, Times, Helvetica, Courier,
rather than Computer Modern). Also, Zaph Dingbats are standard for PDF,
so if you want to use dingbats for something (like separators), use those.
If you want to use extra fancy fonts, make sure that they are Type1
fonts, not Metafont. Even though Metafont is standard for TeX, it
doesn't convert well into PDF.
Secondly, if one is going to use pdflatex, then have two versions of
each illustration (as mentioned above); one in either JPG or PNG, and
the other in EPS format. Now some people might point out that it would
be easier to use the tex2pdf script (which is on Sourceforge, I think)
which automatically converts the EPS files into PDF files which can be
included into the produced PDF file. I have two reasons for not doing
this: the most important one was that all my greyscale pictures got
scrambled when I did this. The second reason is that if the original
file is a bitmap JPG or PNG, then it's better to include the original
file than to do too many conversions.
But those who are using vector graphics would probably prefer another
method.
As has been pointed out before, there is a bug with Ghostscript 5.50
which means that ps2pdf puts bitmap fonts rather than outline fonts into
the PDF file, which makes it bigger and uglier. Unfortunately, 5.50 is
the version which comes standard with RedHat 7.1 (sigh). So I tracked
down an RPM (I'm using RedHat, remember) of a more recent version of
Ghostscript, on <http://rpmfind.net> and found one for version 6.50
(actually, I also found one for version 6.0, but I had trouble
installing it). Who knows, there may actually be an RPM for version 7.0
by now; 7.0 had only recently come out when I was looking.
15) to be able to produce PDF format in small enough chunks to be
downloaded from a web page
The output produced by pdflatex with the hyperref package is very nice,
with bookmarks and links from the table of contents... but with my
fanzine, the resultant file was 3.7M! And compressing the file wouldn't
reduce it very much.
I could have split the file with "split" I suppose, but that wouldn't
give people workable files (and not everyone would be able to figure out
how to put the bits back together again, either).
What I did with my original publication (when I used MS Publisher) was
that I had the whole publication split into multiple files (each one
with its starting page-number set by hand) and I would produce a PDF
file from each separate file.
Unfortunately, with LyX/LaTeX you can't do that, because the document
and all its included files has to be treated as a whole, or the
page-numbering won't be correct.
But there's a way around this limitation, if one doesn't mind producing
PDF files without any bookmarks or linking: print the document to a
file, a certain number of pages at a time. The LyX print dialogue
allows you to print to a file (which will be a Postscript file), and
select the page-range you want to print.
So I printed it out, 20 pages at a time, and produced a number of
Postscript files. Then I ran ps2pdf over the Postscript files.
Voila! The whole document, in smaller, palatable chunks.
I actually ended up doing the cover as a separate document, because I
wanted different page margins for it. I used the "scalefont" package to
do the title on the cover and on the first page (since *those* fancy
fonts were already installed, and outlines do look better than bitmaps).
One thing that I wasn't able to do, which I would have liked to have
done, was to have fancy borders around things. However, yesterday I
found a package at CTAN called "niceframe" which looks like it may do
the trick.
Another kind of fancy border I would like to be able to do is to include
an image (a graphic file) which is a border image (that is, is has nice
things all around the edges, and is empty in the middle) and be able to
plonk something (like a poem, for example) in the middle of it.
I don't know how to do that though.
Well, I hope that this long rambling thing has been helpful to somebody.
Kathryn Andersen
-=-=-=-=-=-=-=-=-
You are not here ->
--
_--_|\ | Kathryn Andersen <[EMAIL PROTECTED]>
/ \ | <http://www.katspace.com>
\_.--.*/ |
v | #include "standard/disclaimer.h"
------------| Melbourne -> Victoria -> Australia -> Southern Hemisphere
Maranatha! | -> Earth -> Sol -> Milky Way Galaxy -> Universe