LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 03-04-2010, 07:35 AM   #1
batonac
LQ Newbie
 
Registered: Feb 2010
Posts: 5

Rep: Reputation: 0
Exclamation Merging files together based on latex syntax.


I have a latex code file which links itself to many other latex files. The syntax is as follows:

\input{*path of file to be inputed*}

The path is relative to the current working directory, so if my file is stored in /home/kevin/mybook.tex and I want to include a file in /home/kevin/latexstuff/copyleft.tex I simply write:

\input{latexstuff/copyleft.tex}

The latex compiler includes these files just as if they had been copied and pasted into the main latex file at the point specified. My problem is that I have a document which depends on quite a bit of these \input commands, but I am trying to use a latex preprocessor (ratexdb, adds database fields to your latex documents) which does not support \input commands, leaving my file only half processed.

So I was wondering: is there any easy way to parse through my main file, detect only the \input commands, interpret the syntax and include the files specified (where specified), and produce a second, populated file, which can then be processed by ratexdb?

I've seen amazing things done with makefiles, bash scripts, grep, cat, perl, etc., but I'm not quite sure how to use these tools to solve my problem.
 
Old 03-05-2010, 07:46 AM   #2
amani
Senior Member
 
Registered: Jul 2006
Location: Kolkata, India
Distribution: 64-bit GNU/Linux, Kubuntu64, Fedora QA, Slackware,
Posts: 2,758

Rep: Reputation: Disabled
Post your problem in the texlive mailing list.
 
Old 03-05-2010, 08:15 AM   #3
batonac
LQ Newbie
 
Registered: Feb 2010
Posts: 5

Original Poster
Rep: Reputation: 0
Lightbulb

Quote:
Originally Posted by amani View Post
Post your problem in the texlive mailing list.
I actually was able to work out a solution with another Latex user. He helped me write the following script which solves my problem completely:

Code:
#! /bin/sh

awk '!/input\{/ {print}
/input\{/ {
sub (/input\{/,"")
sub (/\}.*/,"")
cmd= "cat ./"$1""
system(cmd)
}' inputfile.tex > mergedfile.tex
 
  


Reply

Tags
bash, latex, merge, syntax


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] What's the best way to get LaTeX syntax highlighting in vim on slackware? Allamgir Slackware 3 12-20-2009 11:23 AM
Merging ,pdf files satimis Linux - General 6 11-21-2007 08:31 PM
Merging Two Files using C++ ckoniecny Programming 5 09-26-2006 09:00 AM
Code generation based on latex math ahwkong Programming 0 04-17-2005 06:28 AM
merging movie files ZaphyR Linux - Software 4 09-05-2004 08:26 AM


All times are GMT -5. The time now is 08:14 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration