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::Plugin::Latex(3pm)				User Contributed Perl Documentation			      Template::Plugin::Latex(3pm)

NAME
Template::Plugin::Latex - Template Toolkit plugin for Latex VERSION
This documentation refers to "Template::Plugin::Latex" version 3.02. SYNOPSIS
Sample Template Toolkit code: [%- USE Latex; mystr = "a, b & c" | latex_encode; FILTER latex("pdf"); -%] documentclass{article} egin{document} This is a PDF document generated by LaTeX and the Template Toolkit, with some interpolated data: [% mystr %] end{document} [% END; -%] DESCRIPTION
The "Latex" Template Toolkit plugin provides a "latex" filter that allows the use of LaTeX to generate PDF, PostScript and DVI output files from the Template Toolkit. The plugin uses LaTeX::Driver to run the various LaTeX programs. Processing of the LaTeX document takes place in a temporary directory that is deleted once processing is complete. The standard LaTeX programs ("latex" or "pdflatex", "bibtex" and "makeindex") are run and re-run as necessary until all references, indexes, bibliographies, table of contents, and lists of figures and tables are stable or it is apparent that they will not stabilize. The format converters "dvips", "dvipdf", "ps2pdf" and "pdf2ps" are run as necessary to convert the output document to the requested format. The "TEXINPUTS" environment variable is set up to include the template directory and the "INCLUDES" directories, so that LaTeX file inclusion commands should find the intended files. The output of the filter is binary data (although PDF and PostScript are not stictly binary). You should be careful not to prepend or append any extraneous characters (even space characters) or text outside the FILTER block as this text will be included in the file output. Notice in the example below how we use the post-chomp flags ('-') at the end of the "USE" and "END" directives to remove the trailing newline characters: [% USE Latex(format='pdf') -%] [% FILTER latex %] ...LaTeX document... [% END -%] If you're redirecting the output to a file via the third argument of the Template module's "process()" method then you should also pass the "binmode" parameter, set to a true value to indicate that it is a binary file. use Template; my $tt = Template->new({ INCLUDE_PATH => '/path/to/templates', OUTPUT_PATH => '/path/to/pdf/output', }); my $vars = { title => 'Hello World', } $tt->process('example.tt2', $vars, 'example.pdf', binmode => 1) || die $tt->error(); If you want to capture the output to a template variable, you can do so like this: [% output = FILTER latex %] ...LaTeX document... [% END %] You can pass additional arguments when you invoke the filter, for example to specify the output format. [% FILTER latex(format='pdf') -%] ...LaTeX document... [% END %] If you want to write the output to a file then you can specify an "output" parameter. [% FILTER latex(output='example.pdf') %] ...LaTeX document... [% END %] If you don't explicity specify an output format then the filename extension (e.g. 'pdf' in the above example) will be used to determine the correct format. You can specify a different filter name using the "filter" parameter. [% USE Latex(filter='pdf') -%] [% FILTER pdf %] ...LaTeX document... [% END %] You can also specify the default output format. This value can be "latex", "pdf" or "dvi". [% USE Latex(format='pdf') %] Note: the "LaTeX::Driver" distribution includes three filter programs ("latex2dvi", "latex2pdf" and "latex2ps") that use the "LaTeX::Driver" package to process LaTeX source data into DVI, PDF or PostScript file respectively. These programs have a "-tt2" option to run their input through the Template Toolkit before processing as LaTeX source. The programs do not use the "Latex" plugin unless the template requests it, but they may provide an alternative way of processing Template Toolkit templates to generate typeset output. SUBROUTINES
/METHODS "USE Latex(options)" This statement loads the plugin (note that prior to version 2.15 the filter was built in to Template Toolkit so this statement was unnecessary; it is now required). The "latex" Filter The "latex" filter accepts a number of options, which may be specified on the USE statement or on the filter invocation. "format" specifies the format of the output; one of "dvi" (TeX device independent format), "ps" (PostScript) or "pdf" (Adobe Portable Document Format). The follow special values are also accepted: "pdf(ps)" (generates PDF via PostScript, using "dvips" and "ps2pdf"), "pdf(dvi)" (generates PDF via dvi, using "dvipdfm") "output" the name of the output file, or just the output format "indexstyle" the name of the "makeindex" style file to use (this is passed with the "-s" option to "makeindex") "indexoptions" options to be passed to "makeindex". Useful options are "-l" for letter ordering of index terms (rather than the default word ordering), "-r" to disable implicit page range formation, and "-c" to compress intermediate blanks in index keys. Refer to makeindex(1) for full details. "maxruns" The maximum number of runs of the formatter program (defaults to 10). "extraruns" The number of additional runs of the formatter program after it seems that the formatting of the document has stabilized (default 0). Note that the setting of "maxruns" takes precedence, so if "maxruns" is set to 10 and "extraruns" is set to 3, and formatting stabilizes after 8 runs then only 2 extra runs will be performed. The "latex_encode" filter The "latex_encode" filter encodes LaTeX special characters in its input into their LaTeX encoded representations. It also encodes other characters that have The special characters are: "" (command character), "{" (open group), "}" (end group), "&" (table column separator), "#" (parameter specifier), "%" (comment character), "_" (subscript), "^" (superscript), "~" (non-breakable space), "$" (mathematics mode). "except" Lists the characters that should be excluded from encoding. By default no special characters are excluded, but it may be useful to specify "except = "\{}"" to allow the input string to contain LaTeX commands such as "this is extbf{bold} text". "use_textcomp" By default the "latex_encode" filter will encode characters with the encodings provided by the "textcomp" LaTeX package (for example the Pounds Sterling symbol is encoded as " extsterling{}"). Setting "use_textcomp = 0" turns off these encodings. "table()" The "table()" function provides an interface to the "LaTeX::Table" module. The following example shows how a simple table can be set up. [%- USE Latex; data = [ [ 'London', 'United Kingdom' ], [ 'Berlin', 'Germany' ], [ 'Paris', 'France' ], [ 'Washington', 'USA' ] ] ); text = Latex.table( caption = 'Capitol Cities', label = 'table:capitols', headings = [ [ 'City', 'Country' ] ], data = data ); -%] The variable "text" will hold the LaTeX commands to typeset the table and can be further interpolated into a LaTeX document template. DIAGNOSTICS
Most failures result from invalid LaTeX input and are propogated up from LaTeX::Driver, LaTeX::Encode or LaTeX::Table. Failures detected in this module include: "OUTPUT_PATH is not set" an output filename was specified but the "OUTPUT_PATH" configuration option has not been set. DEPENDENCIES
Template The Template Toolkit. LaTeX::Driver Provides the logic for driving the LaTeX programs. LaTeX::Encode Underpins the "latex_encode" filter. LaTeX::Table Underpins the "table" function. INCOMPATIBILITIES
The "latex" filter was distributed as part of the core Template Toolkit distribution until version 2.15 (released in May 2006), when it was moved into the separate Template-Latex distribution. The "Latex" plugin must now be explicity to enable the "latex" filter. BUGS AND LIMITATIONS
The paths to the latex, pdflatex and dvips should be pre-defined as part of the installation process of LaTeX::Driver (i.e. when you run "perl Makefile.PL" for that package). Alternative values can be specified from Perl code using the "program_path" class method from that package, but there are deliberately no options to specify these paths from TT code. 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. The code has subsequently been radically refactored by Andrew Ford. LICENSE AND COPYRIGHT
Copyright (C) 2006-2009 Andrew Ford. All Rights Reserved. Copyright (C) 1996-2006 Andy Wardley. All Rights Reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. SEE ALSO
Template, LaTeX::Driver, LaTeX::Table, LaTeX::Encode latex2dvi(1), latex2pdf(1) and latex2ps(1) (part of the "LaTeX::Driver" distribution) perl v5.14.2 2009-03-12 Template::Plugin::Latex(3pm)
All times are GMT -4. The time now is 09:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy