Beautifying TeX source file using perl

Joined
Mar 27, 2008
Messages
1
Reaction score
0
I wanted to write a program in perl to clean up source file in TeX.
Source file is an ascii file in which there are special character that indicate special functions. For example, rest of the line after % will be ignored by TeX; any word that start with \ is a command which may not or may have any number of arguments enclosed in {}. Here is my plan for now:

original text:
this is a great project. % this is just my opinion.
% You may disagree.
What do you think?

changed text:
this is a great project.
%%%%%%%%%%%%
%% this is just my opinion.
%% You may disagree.
%%%%%%%%%%%%
What do you think|?


Original text:
Please help me. \yourkindness{will be}{rewarded} by someone. %May not be me.

changed text:
Please help me.
\yourkindness
{will be}
{rewarded}
%%%%%%%%%%%%
%% My not be me.
%%%%%%%%%%%%

Original text:
I would like to convey my \thanks in advance.

Changed text:
I would like to convey my
\thanks
in advance.

Each line in changed text should have atmost 100 characters and
it should not break any word from the orignal text.


Are there any programs already out there with these features?

Will you please give me some suggestions how I can write such a program
in perl?

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top