Regards
Sebastian
csvtools makes this kind of thing pretty easy
\documentclass{article}
\usepackage{filecontents}
\usepackage{csvtools}
\usepackage[margin=5mm,paperwidth=8.9cm,paperheight=5.5cm]{geometry}
\usepackage{eso-pic}
\AddToShipoutPicture{%
\setlength\unitlength{1mm}
\put(64,5){\rule{2cm}{4.5cm}}%
}
\begin{filecontents*}{names.csv}
First,Last,Affiliation
Foo,Bar,Baz
John,Doh,Department of Something
A.,nonym,Institute of Nothing
\end{filecontents*}
\begin{document}
\applyCSVfile{names.csv}{%
\noindent
\begin{minipage}{5.9cm}
\sffamily
{\Large\insertFirst~\insertLast\par}
{\large\itshape\insertAffiliation}%
\end{minipage}\newpage
}
\end{document}
my example:
%& --translate-file=cp1250pl
\documentclass[10pt]{article}
\usepackage{polski}
\usepackage[dvips]{graphics}
\usepackage{filecontents}
\usepackage{csvtools}
\pagestyle{empty}
\usepackage[left=5mm,right=5mm,paperwidth=8.9cm,paperheight=5.5cm]{geometry}
\usepackage{eso-pic}
\AddToShipoutPicture{%
}
\normalsize\normalfont
\begin{document}
\begin{filecontents*}{users.csv}
ImieNaz,Uczelnia
Somebody Bad, from Hell
\end{filecontents*}
\applyCSVfile{users.csv}{%
\noindent
\begin{minipage}{5.9cm}
\sffamily
{\Large\insertImieNaz \par}
{\centering \large\itshape\insertUczelnia}
\end{minipage}
\newpage
}
\end{document}
and also it looks that filecontents* section must be placed after
\begin{document} otherwise i got an error "missing \begin{document}
:(
Sebastian
Put things for the background in \AddToShipoutPicture.
> also is looks that is huge margin from right side larger
> than 5mm even if i remove code for rule placing.:(
> \applyCSVfile{users.csv}{%
> \noindent
> \begin{minipage}{5.9cm}
^^^^^
This sets the width of the text. Don't use the minipage if you
want the text to fill the whole textwidth.
> and also it looks that filecontents* section must be placed after
> \begin{document} otherwise i got an error "missing \begin{document}
That error must be related to something else. The filecontents
environment from LaTeX must go *before* \begin{document}. The
fact that you can put it after is caused by the hacks in
filecontents.sty. You don't need to generate the csv file from
the document source. You can generate it externally and just
extract data in the document.
\documentclass[10pt]{article}
%\usepackage{polski}
\usepackage{graphics}
\usepackage{filecontents}
\usepackage{csvtools}
\usepackage{xcolor}
\pagestyle{empty}
\usepackage[left=5mm,right=5mm,paperwidth=8.9cm,paperheight=5.5cm]{geometry}
\usepackage{eso-pic}
\AddToShipoutPicture{%
\put(0,0){\color{red}\rule{1cm}{5.5cm}}
}
\begin{filecontents*}{users.csv}
ImieNaz,Uczelnia
Somebody Bad, from Hell
\end{filecontents*}
\begin{document}
\applyCSVfile{users.csv}{%
\noindent
\sffamily
{\Large\insertImieNaz \par}
{\centering \large\itshape\insertUczelnia\par}
Some long text that fills the whole textwidth and
wraps to a new line.
\newpage
}
\end{document}
You need to use \includegraphics or \pgfuseimage inside a \put
command if you use \AddToShipoutPicture. If your image-file is
png you need to compile with pdflatex or go via dvipdfm(x) to pdf.
Thanks it works..it is possible to put this image as watermark? with
some kind of opacity...
Sebastian
> Thanks it works..it is possible to put this image as watermark? with
> some kind of opacity...
It is possible to add a imagemask using pgf but doing the image
manipulation with image manipulation software is easier than
doing it via LaTeX macros.
yes thats true..sorry that I found another problem. I prepared IDs and
they looks great but...on a4 paper put together they have no border..so
i guess i should create framebox of the size declared in geometry but
but \framebox is fragile and I dont know if nesting works in such
environments..something like
\AddToShipoutPicture{%
\framebox(8.7cm,5.5cm){}
\}
or \framebox(8.7cm,5.5cm){
\addotshipoutPicture{
}
}
produces errors.
Regards
Sebastian
I thought you wanted to create each card on a separate pages with
the dimension 8.9cm x 5.5cm? Add `dvips' to the geometry option
list if you use latex and dvips and don't want to tell dvips the
pagesize yourself.
> but \framebox is fragile and I dont know if nesting works in such
> environments..something like
> \AddToShipoutPicture{%
> \framebox(8.7cm,5.5cm){}
> \}
>
> or \framebox(8.7cm,5.5cm){
> \addotshipoutPicture{
> }
> }
> produces errors.
This is not related to fragile commands. Everything in
\AddToShipoutPicture have to be \put in place. Post a complete
running example of what you are doing.
\AddToShipoutPicture{%
\setlength\unitlength{1cm}
\put(0,0){\framebox(8.9,5.5)[lb]{}}}