Support LQ: Use code LQ3 and save $3 on Domain Registration  Home Forums HCL Reviews Tutorials Articles Register Search Today's Posts Mark Forums Read  LinuxQuestions.org something i've never done...printers?  User Name Remember Me? Password  Programming This forum is for all programming questions. The question does not have to be directly related to Linux and any language is fair game. Notices  08-12-2003, 03:15 PM #1 sk8guitar Member Registered: Jul 2003 Location: DC Distribution: mandrake 9.1 Posts: 415 Rep: something i've never done...printers? hey, ok, i'm not sure if this is the right forum but whatever i have a little script that i wrote that prints out a crapload of addresses (something around 2500) now i'd rather not have to sit there cut them out and paste them onto a label. instead i would like to be able to format them all so that they can print on the backs of these flyers i am going to send out (there will be something like 2 or 3 flyers per page of paper). is there any way to somehow spool this to a printer, or a practical way of formatting this information so that it requires as little work as possible on my part? i only really know perl so thats what i'm using right now to just show all the addresses. and if you ask how i can just randomly generate 2500 addresses its because its going to be on campus and addresses are just sequential by building.  08-12-2003, 05:23 PM #2 kev82 Senior Member Registered: Apr 2003 Location: Lancaster, England Distribution: Debian Etch, OS X 10.4 Posts: 1,263 Rep: im sure theres a better way to do it but why not get perl to produce a TeX source file. then compile that to give you a pdf and print it out.  08-12-2003, 06:14 PM #3 sk8guitar Member Registered: Jul 2003 Location: DC Distribution: mandrake 9.1 Posts: 415 Original Poster Rep: ok, that sounds good but i don't know what a tex source file is. could you maybe help guide me through this?  08-12-2003, 06:26 PM #4 kev82 Senior Member Registered: Apr 2003 Location: Lancaster, England Distribution: Debian Etch, OS X 10.4 Posts: 1,263 Rep: im not a TeX/LaTeX expert but i'll give it a go. have you got a program called latex installed?  08-12-2003, 06:34 PM #5 sk8guitar Member Registered: Jul 2003 Location: DC Distribution: mandrake 9.1 Posts: 415 Original Poster Rep: i do now  08-12-2003, 06:43 PM #6 kev82 Senior Member Registered: Apr 2003 Location: Lancaster, England Distribution: Debian Etch, OS X 10.4 Posts: 1,263 Rep: right, latex is what is known as a typesetter, in a program like abiword you do the formatting by pressing keys and menus tex is more like html, you include commands in the document to describe how the document is formatted. just to test if its working create the following file Code: \documentclass{article} \begin{document} Hello \end{document} and call it something.tex at the command line type latex something.tex followed by xdvi something.dvi you should see an a4 page with the word hello written at the top. the idea is to write a perl script that creates a tex file full of your addresses and the appropriate formatting that once compiled will be exactly what you want and you can print it out.  08-12-2003, 06:50 PM #7 sk8guitar Member Registered: Jul 2003 Location: DC Distribution: mandrake 9.1 Posts: 415 Original Poster Rep: i'm not sure if this is the right thing or not (i'm thinking it is because i went into my folder and double clicked on something.dvi and it said hello). i just want to make sure this output is what correct output is: Code: [akropp@localhost tex]$ latex something.txt xdvi something.dvi This is TeX, Version 3.14159 (Web2C 7.4.5) (./something.txt LaTeX2e <2001/06/01> Babel and hyphenation patterns for american, french, german, ngerman, b asque, italian, portuges, russian, spanish, nohyphenation, loaded. (/usr/share/texmf/tex/latex/base/article.cls Document Class: article 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo)) (./something.aux) [1] (./something.aux) ) Output written on something.dvi (1 page, 220 bytes). Transcript written on something.log. [akropp@localhost tex]$ls something.aux something.dvi something.log something.txt  08-12-2003, 06:51 PM #8 sk8guitar Member Registered: Jul 2003 Location: DC Distribution: mandrake 9.1 Posts: 415 Original Poster Rep: kev, could you maybe give me an example of how i could do this in perl and maybe a website that shows me the functions of tex/latex? and btw thanks for helping me out, i really appreciate it kev  08-12-2003, 07:00 PM #9 kev82 Senior Member Registered: Apr 2003 Location: Lancaster, England Distribution: Debian Etch, OS X 10.4 Posts: 1,263 Rep: the output above is fine but i meant Code: $ latex something.tex (latex output) \$ xdvi something.dvi the xdvi does the same as you double clicking on something.dvi Here is a pretty good website on latex. do you wana try and get on with it yourself then or did you want me to continue as for me showing you how to do it in perl, i dont know perl, i thought you did but that doesnt matter, its just as easy to use bash script instead.
 08-12-2003, 07:00 PM #10 sk8guitar Member   Registered: Jul 2003 Location: DC Distribution: mandrake 9.1 Posts: 415 Original Poster Rep: actually kev, i found some good tex tutorials. but i'm still not sure how to implement them with perl. unless you are saying that i format the output of the perl file in tex standards and then compile that tex file. actually i'm gonna try that tomorrow and let you know how it all goes
08-12-2003, 07:05 PM   #11
kev82
Senior Member

Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep:
Quote:
 by sk8guitar unless you are saying that i format the output of the perl file in tex standards and then compile that tex file.
if i understand you right then that is exactly what i mean.

 08-12-2003, 07:10 PM #12 sk8guitar Member   Registered: Jul 2003 Location: DC Distribution: mandrake 9.1 Posts: 415 Original Poster Rep: word. i'll hit that up tomorrow at "work" :P
 08-12-2003, 07:35 PM #13 kev82 Senior Member   Registered: Apr 2003 Location: Lancaster, England Distribution: Debian Etch, OS X 10.4 Posts: 1,263 Rep: your perl script wants to produce something like This if i understand what you want. I know nothing about printing but to get you a bit further than the dvi you want dvips -Ppdf something.dvi to get a postscript file, and ps2pdf something.ps to get a pdf file Last edited by kev82; 08-12-2003 at 07:40 PM.
 08-13-2003, 04:39 AM #14 DIYLinux Member   Registered: Jul 2003 Location: NL Distribution: My own Posts: 92 Rep: Why not a2ps or enscript ? With (La)TeX you can produce very pretty reports, but it takes a lot of work. a2ps and enscript turn plain text files into postscript with a minimum of fuz. No need for dvips either.
 08-13-2003, 05:23 AM #15 kev82 Senior Member   Registered: Apr 2003 Location: Lancaster, England Distribution: Debian Etch, OS X 10.4 Posts: 1,263 Rep: i dont really know what im talking about here but sk8guitar wants 2-3 addresses per page so the spacing needs to be right. i dont think you can do this with a2ps/enscript but as i say im not sure. also i dont think the amount of work to do this in latex is hard at all see the above link to a sample tex file.