+ Reply to Thread
Results 1 to 8 of 8

Thread: Needs help in constructing an amslatex.vdf file.

  1. #1
    Senior Member
    Join Date
    Nov 2014
    Location
    Minneapolis, MN
    Posts
    294

    Needs help in constructing an amslatex.vdf file.

    Scott,

    A big thank you for latex2e.vdf.

    Now I would like to construct an amslatex.vdf file.
    First, I would like to try a strategy, similar to the on used to construct the larex2e.vdf file.
    In other words, look for an amslatex manual in the Miktex 2.9 documentation. I found two files which are good candidates.

    My problem is that they are in .pdf format. So, my question is, can you extract latex commands from a .pdf file ?

    -peter

  2. #2
    Senior Member
    Join Date
    Aug 2011
    Location
    British Columbia, Canada
    Posts
    383
    Hi Peter,

    Vedit will of course load a pdf file, but what you see makes no sense. As you may know, the format is based on PostScript. Writing a macro to decode that is way above pay scale

    In my version of Acrobat Reader, there is in the File menu, an option to "Save as text". So I opened the Vedit User Manual from within Vedit, and used this option, and I did get a text file with absolutely no formatting, just the words.

    The other option if not too many pages is you can highlight pages and right-click to copy and then paste into Vedit.

    Scott
    Using Vedit 6.21.3, (32 bit), dated 9/12/11 running on Windows 7 (64 bit).

  3. #3
    Senior Member
    Join Date
    Nov 2014
    Location
    Minneapolis, MN
    Posts
    294
    Quote Originally Posted by Scott Lambert View Post
    Hi Peter,

    In my version of Acrobat Reader, there is in the File menu, an option to "Save as text". So I opened the Vedit User Manual from within Vedit, and used this option, and I did get a text file with absolutely no formatting, just the words.

    Scott
    Hi Scott,

    I have a hunch that in the Vedit Macro Language Reference manual the Vedit commands have an "( )" string right after the command.

    Now my question is about your "extraction macro". In other words, I take that you used a macro to extract the latex commands from the Karl Berry file that I have sent you. My specific question is: In order to apply your macro do you need some formatting requirements ?

    Actually, this leads to another question about latex2e.vdf. How complete is latex2e.vdf ? One possible source of missing a latex command is that I made a typo in preparing the truncated file for you. I had no choice, I had to meet the 19KB limit of the our bulletin board.
    So, I did it by hand. I certainly would prefer to automate this procedure, but I can not. In short, could your macro handle the original Karl Berry file ?


    It is getting late.

    Thanks ,

    -peter

  4. #4
    Senior Member
    Join Date
    Aug 2011
    Location
    British Columbia, Canada
    Posts
    383
    Hi Peter,

    The key to extracting stuff from a file is you need a common landmark to search for. For example that last txt file you gave me, I used search("* \",advance+noerr).

    Here is the complete macro:

    #10=buf_num
    #11=buf_free
    buf_switch(#11)
    file_open("|(user_home)\latex2e.txt")
    buf_switch(#10)
    goto_line(59)
    repeat(all) {
    search("* \",advance+noerr)
    if(return_value==0) {break}
    if(cur_line>=846) {break}
    block_begin(cur_pos)
    search("|S",noerr)
    if(return_value==0) {break}
    block_end(cur_pos)
    reg_copy_block(10,block_begin,block_end)
    buf_switch(#11)
    reg_ins(10)
    ins_newline(1)
    buf_switch(#10)
    }

    So basically, I open a file to receive the extracted info, then I go to a line number close to where the info I need is located, then I search for my landmark,"* \", and then grab the letters that follow to the next separator, and then dump that word in the file I opened for that purpose. I have the line:

    if(cur_line>=846) {break}

    This breaks the loop once we have reached the last relevant line.

    So basically to adapt this macro to your next text file, I just have to find my landmark and modify the lines that refer to line numbers.

    I have no idea how complete latex2e.vdf is. You are the Latex expert here. What I don't know about Latex is a hole with no bottom. My suggestion is just use it awhile and if Scribe never flags a Latex word, it is complete for your purposes.

    Scott
    Using Vedit 6.21.3, (32 bit), dated 9/12/11 running on Windows 7 (64 bit).

  5. #5
    Senior Member
    Join Date
    Nov 2014
    Location
    Minneapolis, MN
    Posts
    294
    Quote Originally Posted by Scott Lambert View Post
    Hi Peter,

    I have no idea how complete latex2e.vdf is. You are the Latex expert here. What I don't know about Latex is a hole with no bottom. My suggestion is just use it awhile and if Scribe never flags a Latex word, it is complete for your purposes.

    Scott
    Hi Scott,

    A big thank you for sharing your rather sophisticated "extraction macro" with me.

    About, the completeness of the latex2e.vdf file, I have the informal attitude that :
    if it is good enough for MiKTex 2.9 then, it is good enough for me. In other words, it is the same attitude as yours. Only the words are different.

    Now I would like to come back to your .pdf message. In short, I would like to come back to the vedit.vdf versus the Appendix F of the Vedit Language Reference Manual question. In my version of the Acrobat Reader I do not have the option of saving in .txt format.
    However, I did succeed in copying page 1 of that Appendix to Vedit. Then I take, using clip-clatch I could copy the rest of that Appendix.

    I learned that with the exception of two Vedit Commands, the commands were followed by the string ( ) . Without studying your macro, I believ that it should work for the string ( ) in place of the string \ . In other words, your extraction macro should give a bunch of Vedit commands. The question is, did I catch any new ones ?

    Thanks as always.

    -peter

  6. #6
    Senior Member
    Join Date
    Aug 2011
    Location
    British Columbia, Canada
    Posts
    383
    Hi Peter,

    I think the attached vedit.vdf is as complete as practically possible. Remember Ted is always adding new commands, parameters, etc. Besides that appendix is out of date anyways, it is version 6.0, we are up to 6.2.
    If you encounter any missing stuff, it is very easy to just add it to the vedit.vdf file at that point. I say we have done what we can.

    Scott
    Attached Files Attached Files
    Using Vedit 6.21.3, (32 bit), dated 9/12/11 running on Windows 7 (64 bit).

  7. #7
    Senior Member
    Join Date
    Nov 2014
    Location
    Minneapolis, MN
    Posts
    294

    The completeness question and the latex2evdf.txt file revisited.

    Quote Originally Posted by Scott Lambert View Post
    Hi Peter,

    The key to extracting stuff from a file is you need a common landmark to search for. For example that last txt file you gave me, I used search("* \",advance+noerr).

    Here is the complete macro:

    #10=buf_num
    #11=buf_free
    buf_switch(#11)
    file_open("|(user_home)\latex2e.txt")
    buf_switch(#10)
    goto_line(59)
    repeat(all) {
    search("* \",advance+noerr)
    if(return_value==0) {break}
    if(cur_line>=846) {break}
    block_begin(cur_pos)
    search("|S",noerr)
    if(return_value==0) {break}
    block_end(cur_pos)
    reg_copy_block(10,block_begin,block_end)
    buf_switch(#11)
    reg_ins(10)
    ins_newline(1)
    buf_switch(#10)
    }

    So basically, I open a file to receive the extracted info, then I go to a line number close to where the info I need is located, then I search for my landmark,"* \", and then grab the letters that follow to the next separator, and then dump that word in the file I opened for that purpose. I have the line:

    if(cur_line>=846) {break}

    This breaks the loop once we have reached the last relevant line.

    So basically to adapt this macro to your next text file, I just have to find my landmark and modify the lines that refer to line numbers.

    I have no idea how complete latex2e.vdf is. You are the Latex expert here. What I don't know about Latex is a hole with no bottom. My suggestion is just use it awhile and if Scribe never flags a Latex word, it is complete for your purposes.

    Scott
    Hi Scott,

    You asked me before about my motivation for my word_find.vdm subroutine and your extension of it, the getword.vdm subroutine. So, I ended up at this message.

    I have a hunch that latex2e.vdf is correct/complete with reference to the Berry Latex Commands of type (a) and with reference to the Berry file of latex2e.txt. That is to say, your conversion macro did copy all Latex commands of the form
    \ followed by a string of letters from the Berry file latex2e.txt .

    So, I would add this to the latex2evdf.txt file of the latex2e package. I would also add that the macro is included, so similar extractions can be made from similar files. Of course, feed backs are always appreciated.


    Now, I would like to think about the possibility that a typo did sneak in. First, I was concerned about the Search("|S") versus the Search("|A"). In other words, may be one hits an _ after the \ and before the separator. Unlikely, but possible ? Now the Search("|A") in your getword subroutine takes care of this. Another possible typo would be
    \begin{commands} versus \begin{command}. However, this is not of Berry type (a), so it is not in vedit.vdf.

    In any case I would emphasize that the conversion is done by a macro and so human error is excluded.
    (In fact, originally this was a concern of mine, since I had to do some editing of latex2e.txt to meet the forum.vedit.com size restrictions. )


    -peter

  8. #8
    Senior Member
    Join Date
    Nov 2014
    Location
    Minneapolis, MN
    Posts
    294
    Quote Originally Posted by Scott Lambert View Post
    Hi Peter,

    Vedit will of course load a pdf file, but what you see makes no sense. As you may know, the format is based on PostScript. Writing a macro to decode that is way above pay scale

    In my version of Acrobat Reader, there is in the File menu, an option to "Save as text". So I opened the Vedit User Manual from within Vedit, and used this option, and I did get a text file with absolutely no formatting, just the words.

    The other option if not too many pages is you can highlight pages and right-click to copy and then paste into Vedit.

    Scott

    Thanks Scott,

    I missed that point. I am slowly catching up.

    -peter

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts