Beautifying TeX source file using perl

Discussion in 'Perl' started by rgompa, Mar 29, 2008.

  1. rgompa

    rgompa

    Joined:
    Mar 27, 2008
    Messages:
    1
    Likes Received:
    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.
     
    rgompa, Mar 29, 2008
    #1
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.
Similar Threads
  1. =?Utf-8?B?TWlrZSBNb29yZQ==?=

    Numeric Entry Only Tex Box

    =?Utf-8?B?TWlrZSBNb29yZQ==?=, Nov 12, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    17,033
    Peter Blum
    Nov 15, 2004
  2. Darren Clark

    Parsing Email bounce back tex

    Darren Clark, Feb 23, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    2,781
    MasterGaurav
    Feb 24, 2005
  3. Cloud Burst
    Replies:
    11
    Views:
    1,703
  4. Oleg Paraschenko

    TeXML, the XML vocabulary for TeX

    Oleg Paraschenko, Apr 12, 2004, in forum: XML
    Replies:
    0
    Views:
    685
    Oleg Paraschenko
    Apr 12, 2004
  5. Neha Chopra

    Auto Complete using tex input

    Neha Chopra, Dec 7, 2007, in forum: Ruby
    Replies:
    5
    Views:
    404
    Xavier Noria
    Dec 10, 2007
  6. Eden Cardim

    generating C source from Perl source

    Eden Cardim, Dec 5, 2005, in forum: Perl Misc
    Replies:
    16
    Views:
    366
    Eden Cardim
    Dec 7, 2005
  7. Kuhl
    Replies:
    1
    Views:
    478
    Tad J McClellan
    Dec 22, 2008
Loading...