Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Converting multiple latex files to pdf Post 302275113 by spirtle on Friday 9th of January 2009 10:03:11 AM
Old 01-09-2009
It's not clear to me what the problem is, but you should probably change to each directory and run Latex from there. That way, the .aux file will not be overwritten (which could be important if you have to run Latex twice to resolve references and such like).
Also, I guess you really want to rename the pdf file rather than the dvi file.
Code:
for file in *; do
    if [ -d $file ]; then
        cd $file
        latex zadaci.latex
        dvipdf zadaci.dvi
        mv zadaci.pdf $file.pdf
        cd -
    fi
done

A possible solution using find is
Code:
for file in `find . -type d -maxdepth 1`; do
    cd $file
    latex zadaci.latex
    dvipdf zadaci.dvi
    mv zadaci.pdf $file.pdf
    cd -
done


Last edited by spirtle; 01-09-2009 at 11:03 AM.. Reason: fixed typo
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Converting ps file to pdf

I have a number of post script files (*.ps) which I need to convert into Pdf. I am using the ps2pdf command for this, but the trouble is that this commands takes only one input at a time. So the command ps2pdf *.ps doesnt work. how can I make a script which will take each .ps file from... (3 Replies)
Discussion started by: jasjot31
3 Replies

2. AIX

AIX converting PDF to PS

my app creates pdf and prints them on windows. I want to run the same app on AIX 5.2. I convert PDF to PS using acroread command. But some options of acroread like landscape etc do not work. I came to know from google that there is bug with acroread for AIX with landscape option. Can you suggest... (3 Replies)
Discussion started by: vinayakshukre
3 Replies

3. UNIX for Dummies Questions & Answers

Converting LATEX PDF to WORD document

Hi there, is it possible to convert pdf files to Word with some free :p software or with some trick??? Now I'm working with LATEX and I can get pdf format but I would like to get .rtf or .doc files too:rolleyes:. Lately I found something like that, but it wasn't free. Thanks for any... (1 Reply)
Discussion started by: Giordano Bruno
1 Replies

4. Shell Programming and Scripting

fetching multiple pdf files from website

I need some help in getting all pdf files from a website after logging into a session. Website requires me to enter my email address then it logs me into a session where it gives me link to download all the pdf files. Is there a way i can automate this using wget or curl? (3 Replies)
Discussion started by: shehzad_m
3 Replies

5. Shell Programming and Scripting

Converting html to pdf perl

Hi All, I have a requirement of converting an html form into pdf using perl. The html form contains images, tables and css implementation. I tried using various perl modules but failed to achive the target. I succeeded in generating a pdf from the html file using... (2 Replies)
Discussion started by: DILEEP410
2 Replies

6. Shell Programming and Scripting

Script for converting a pdf to book format

Hello, excuse my English... I'm trying to do a nautilus-script to transform a normal A4 pdf to another pdf with book format, ready to be printed (double sided). I mean, the script put pages in order and also put 2 pages per horizontal A4 page (p.e.: a pdf with 8 pages would look like: 8-1, 2-7,... (2 Replies)
Discussion started by: dokan
2 Replies

7. Shell Programming and Scripting

Help converting column to row for multiple files

Hi all, I am pretty new at this so be gentle. Also, if there is any chance you could explain what the code you use is actually doing, that would really help me out, Im learning after all :) So I am trying to convert a selected column of numbers from input file1 into a row in output file2 ... (3 Replies)
Discussion started by: StudentServitor
3 Replies

8. UNIX for Dummies Questions & Answers

Converting pdf to jpg in multiple directories?

Hi! On my Ubuntu I have thousands of files in a couple hundred directories. I'm trying to convert the pdf's to jpg's. I used this command in terminal: for fname in *.pdf; do convert $fname ${fname%.pdf}.jpg; doneIt works great but the problem is I have to run this in terminal for each... (2 Replies)
Discussion started by: martinsmith
2 Replies

9. UNIX for Dummies Questions & Answers

Pdftotext from multiple pdf files to a single text file

I have a directory having a number of pdf files. I want to convert all the files to text, stored in a single text file The following creates multiple text files ls *.pdf | xargs -n1 pdftotext (1 Reply)
Discussion started by: kristinu
1 Replies

10. Shell Programming and Scripting

Converting secured pdf files to pdf using acroread

Does anybody have idea of Converting secured pdf files to pdf using acroread ? ---------- Post updated at 04:49 PM ---------- Previous update was at 04:44 PM ---------- This file is not password protected. (4 Replies)
Discussion started by: Soham
4 Replies
Template::Latex(3pm)					User Contributed Perl Documentation				      Template::Latex(3pm)

NAME
Template::Latex - Latex support for the Template Toolkit SYNOPSIS
use Template::Latex; my $tt = Template::Latex->new({ INCLUDE_PATH => '/path/to/templates', OUTPUT_PATH => '/path/to/pdf/output', LATEX_FORMAT => 'pdf', }); my $vars = { title => 'Hello World', } $tt->process('example.tt2', $vars, 'example.pdf', binmode => 1) || die $tt->error(); DESCRIPTION
The Template::Latex module is a wrapper of convenience around the Template module, providing additional support for generating PDF, PostScript and DVI documents from LaTeX templates. You use the Template::Latex module exactly as you would the Template module. my $tt = Template::Latex->new(\%config); $tt->process($input, \%vars, $output) || die $t->error(); It supports a number of additional configuration parameters. The "LATEX_PATH", "PDFLATEX_PATH" and "DVIPS_PATH" options can be used to specify the paths to the latex, pdflatex and dvips program on your system, respectively. These are usually hard-coded in the Template::Latex $LATEX, $PDFLATEX and $DVIPS package variables based on the values set when you run "perl Makefile.PL" to configure Template::Latex at installation time. You only need to specify these paths if they've moved since you installed Template::Latex or if you want to use different versions for some reason. my $tt = Template::Latex->new({ LATEX_PATH => '/usr/bin/latex', PDFLATEX_PATH => '/usr/bin/pdflatex', DVIPS_PATH => '/usr/bin/dvips', }); It also provides the "LATEX_FORMAT" option to specify the default output format. This can be set to "pdf", "ps" or "dvi". my $tt = Template::Latex->new({ LATEX_FORMAT => 'pdf', }); The "latex" filter is automatically defined when you use the Template::Latex module. There's no need to load the Latex plugin in this case, although you can if you want (e.g. to set some configuration defaults). If you're using the regular Template module then you should first load the Latex plugin to define the "latex" filter. [% USE Latex %] [% FILTER latex('example.pdf') %] ...LaTeX doc... [% END %] PUBLIC METHODS
The Template::Latex module is a subclass of the Template module and inherits all its methods. Please consult the documentation for the Template module for further information on using it for template processing. Wherever you see "Template" substitute it for "Template::Latex". In addition to those inherted from the Template module, the following methods are also defined. latex_paths() Method to get or set the paths to the latex, pdflatex and dvips programs. These values are stored in the Template::Latex $LATEX, $PDFLATEX and $DVIPS package variables, respectively. It can be called as either a class or object method. Template::Latex->latex_paths({ latex => '/usr/bin/latex', pdflatex => '/usr/bin/pdflatex', dvips => '/usr/bin/dvips', }); my $paths = Template::Latex->latex_paths(); print $paths->{ latex }; # /usr/bin/latex latex_path() Method to get or set the $Template::Latex::LATEX package variable which defines the location of the latex program on your system. It can be called as a class or object method. Template::Latex->latex_path('/usr/bin/latex'); print Template::Latex->latex_path(); # '/usr/bin/latex' pdflatex_path() Method to get or set the $Template::Latex::PDFLATEX package variable which defines the location of the pdflatex program on your system. It can be called as a class or object method. Template::Latex->pdflatex_path('/usr/bin/pdflatex'); print Template::Latex->pdflatex_path(); # '/usr/bin/pdflatex' dvips_path() Method to get or set the $Template::Latex::DVIPS package variable which defines the location of the dvips program on your system. It can be called as a class or object method. Template::Latex->dvips_path('/usr/bin/dvips'); print Template::Latex->dvips_path(); # '/usr/bin/dvips' bibtex_path() Method to get or set the $Template::Latex::BIBTEX package variable which defines the location of the bibtex program on your system. It can be called as a class or object method. Template::Latex->bibtex_path('/usr/bin/bibtex'); print Template::Latex->bibtex_path(); # '/usr/bin/bibtex' makeindex_path() Method to get or set the $Template::Latex::MAKEINDEX package variable which defines the location of the makeindex program on your system. It can be called as a class or object method. Template::Latex->makeindex_path('/usr/bin/makeindex'); print Template::Latex->makeindex_path(); # '/usr/bin/makeindex' INTERNALS
This section is aimed at a technical audience. It documents the internal methods and subroutines as a reference for the module's developers, maintainers and anyone interesting in understanding how it works. You don't need to know anything about them to use the module and can safely skip this section. define_filter($context,\%config) This class method installs the "latex" filter in the context passed as the first argument. The second argument is a hash reference containing any default filter parameters (e.g. those specified when the Template::Plugin::Latex plugin is loaded via a "USE" directive). Template::Latex->define_filter($context, { format => 'pdf' }); The filter is installed as a dynamic filter factory. This is just a fancy way of saying that the filter generates a new filter subroutine each time it is used to account for different invocation parameters. The filter subroutine it creates is effectively a wrapper (a "closure" in technical terms) around the "filter()" subroutine (see below) which does the real work. The closure keeps track of any configuration parameters specified when the filter is first defined and/or when the filter is invoked. It passes the merged configuration as the second argument to the "filter()" subroutine (see below). See the Template::Filters module for further information on how filters work. filter($text,\%config) This is the main LaTeX filter subroutine which is called by the Template Toolkit to generate a LaTeX document from the text passed as the first argument. The second argument is a reference to a hash array of configuration parameters. These are usually provided by the filter subroutine that is generated by the filter factory. Template::Latex::filter($latex, { latex => '/usr/bin/latex', pdflatex => '/usr/bin/pdflatex', dvips => '/usr/bin/dvips', output => 'example.pdf', }); throw($message) Subroutine which throws a Template::Exception error using "die". The exception type is set to "latex". Template::Latex::throw("I'm sorry Dave, I can't do that"); debug($message) Debugging subroutine which print all argument to STDERR. Set the $DEBUG package variable to enable debugging messages. $Template::Latex::DEBUG = 1; AUTHOR
Andrew Ford <a.ford@ford-mason.co.uk> (current maintainer) Andy Wardley <abw@wardley.org> <http://wardley.org/> The original Latex plugin on which this is based was written by Craig Barratt with additions for Win32 by Richard Tietjen. COPYRIGHT
Copyright (C) 1996-2006 Andy Wardley. All Rights Reserved. Copyright (C) 2006-2007 Andrew Ford. All Rights Reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
Template::Plugin::Latex perl v5.14.2 2007-10-16 Template::Latex(3pm)
All times are GMT -4. The time now is 08:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy