Document Classeslandscape flyer on 8.5x11 paper.

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
michaelburns
Posts: 3
Joined: Wed Sep 23, 2009 8:00 pm

landscape flyer on 8.5x11 paper.

Post by michaelburns »

Hey everyone.
I tried to find a class for making a single-page landscape flyer, but the closest I came up with were classes for posters, and I didn't understand LaTeX well enough to modify them for my purpose. So, I started writing my own class, but it is so sloppy, and every time I modify it I get errors. So, if anyone can make suggestions...

More specifically:
- I want to use LaTeX (MikTeX 2.7) to produce a pdf file of a single, one-sided, 8.5 x 11 page.
- I want one of the long edges to have several repetitions of my contact info, so that I can make those tabs that people can tear off.
- I want a clean way of placing a title and laying out textblocks in artistic ways on the page in the .tex file. That is, I want to contain all of the dirty commands with wierd, user-unfriendly syntax in the .cls file, and provide straightforward access to things like size, color, positioning, and rotation (size and positioning are most important).
- I want a faded background image(s).

So far I have my little project dispersed into various files: flyer.cls, flyer.tex, flyerbg.tex, and the various image files and output files that are produced. I will post my code for flyer.cls.

Code: Select all

%%% flyer.cls
%%%
%%% Michael Burns
%%% 2009 September 18 - 2009 September 23
%%% This class does not work with:
%%%    latex file.tex
%%%    dvips file.dvi -o file.ps
%%%    ps2pdf file.ps
%%% Use instead:
%%%    pdflatex file.tex
%%%
%%% The flyer is typeset as a landscape, and it will likely appear sideways
%%% in a pdf viewer.
%%% There are three commands, \tearofffrstline{},
%%% \tearoffscndline{}, and \tearoffthrdline{}, whose arguments are printed
%%% in a series of tear-offs along the bottom (long edge) of the flyer.
%%% The main content of the flyer goes in the \begin{content}\end{content}
%%% environment.
%%% There must be a file, flyerbg.eps, that contains the background image.



\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{flyer}[2009/09/18 LaTeX class for typesetting flyers]
\LoadClass{article}

\RequirePackage[absolute]{textpos}
\RequirePackage{color}
\RequirePackage{rotating}
\RequirePackage{fix-cm}
\RequirePackage{calc}
\RequirePackage{eso-pic}
\RequirePackage{verbatim}

%\setlength{\hoffset}{-1in}
%\setlength{\oddsidemargin}{0pt}
%\setlength{\evensidemargin}{0pt}
%\setlength{\marginparsep}{0pt}
%\setlength{\marginparwidth}{0pt}
%\setlength{\textwidth}{\paperwidth}
%\addtolength{\textwidth}{-2in}

%\setlength{\voffset}{-1in}
%\setlength{\topmargin}{0pt}
%\setlength{\headheight}{0pt}
%\setlength{\headsep}{0pt}
%\setlength{\footskip}{0pt}
%\setlength{\textheight}{\paperheight}
%\addtolength{\textheight}{-2in}

\pagestyle{empty}
\setcounter{secnumdepth}{0}

\pdfpagewidth=\paperwidth
\pdfpageheight=\paperheight

\setlength{\parindent}{0pt}

\renewcommand{\Huge}{\fontsize{50}{60}\selectfont}
\renewcommand{\huge}{\fontsize{30}{36}\selectfont}
\renewcommand{\Large}{\fontsize{20}{25}\selectfont}

\TPGrid[0pt,0pt]{10}{10}

\newenvironment{precontent}
   {\begin{textblock}{6}[0.5,0.5](4,5)}
   {\end{textblock}}
\newenvironment{content}
   {\begin{precontent}\begin{sideways}\begin{minipage}[c]{8\TPVertModule}}
   {\end{minipage}\end{sideways}\end{precontent}}

%%% First attempt at background image:
%\newcommand{\BackgroundEPS}[4]{
%   \special{ps: @beginspecial @setspecial initmatrix
%               0.9 setgray #2 #3 translate #4 dup scale}
%   \special{ps: plotfile #1}
%   \special{ps: @endspecial}
%}
%\BackgroundEPS{flyerbg.eps}{1}{1}{1}

%%% Second attempt at background image:
%\AddToShipoutPicture{
%   \put(0,0){\includegraphics{flyerbg}}
%}

%%% Third attempt at background image:
%\newenvironment{textbg}[3]
%   {\begin{\textblock}{1}[0.5,0.5](#1,#2)\huge\begin{turn}{#3+90}}
%   {\end{turn}\end{\textblock}}

\newcommand{\@tearofffrstline}{}
\newcommand{\tearofffrstline}[1]{\renewcommand{\@tearofffrstline}{#1}}
\newcommand{\@tearoffscndline}{}
\newcommand{\tearoffscndline}[1]{\renewcommand{\@tearoffscndline}{#1}}
\newcommand{\@tearoffthrdline}{}
\newcommand{\tearoffthrdline}[1]{\renewcommand{\@tearoffthrdline}{#1}}
\newcommand{\maketearoff}{
   \mbox{
   \begin{tabular}{l}
   \@tearofffrstline\\
   \@tearoffscndline\\
   \@tearoffthrdline
   \end{tabular}
   }\\[15pt]
}   
\newcommand{\maketearoffs}{
   \begin{textblock}{3}[1,0.5](10,5)\begin{flushright}
   \maketearoff
   \maketearoff
   \maketearoff
   \maketearoff
   \maketearoff
   \maketearoff
   \maketearoff
   \maketearoff
   \maketearoff
   \maketearoff
   \maketearoff
   \maketearoff
   \maketearoff
   \maketearoff
   \maketearoff
   \end{flushright}\end{textblock}
}
\AtEndDocument{\maketearoffs}
I am having particular trouble, at the moment, with the background image. I have no idea what I'm doing; I just google-searched and hacked some code snippets.
I need a job

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

landscape flyer on 8.5x11 paper.

Post by localghost »

michaelburns wrote:[...] I am having particular trouble, at the moment, with the background image. [...]
Try the wallpaper package. Although the according lines are commented you should not set page and paper dimensions this way. Use the geometry package instead.


Best regards and welcome to the board
Thorsten
Post Reply