Menu

source formatting

Developers
2003-06-15
2003-06-17
  • Thomas Kuhn

    Thomas Kuhn - 2003-06-15

    i am using eclipse to write my tex files (i use the standard text editor). one thing that disturbes me a lot is that when i move a bit of text or a command, a "hole" remains in the text.
    some kind of source formatter functionallity could be nice, i think (did we already talk about this? i scanned the briefing-log, but dod not find anything...).
    we could go even one step further and implement some sort of "auto formatter", because tex file are not so clearly structured as e.g. a java-source, they contain both, commands and prose text. an auto-formatter could brake the lines after 80 characters. similar behaviour as word-processors.
    this would be a prio 2 task, when not a prio 3.

    what do you think?

     
    • Manuel Prinz

      Manuel Prinz - 2003-06-16

      I don't really get what you're talking about, I have to say... I do my Latex files with Eclipse as well but don't experience the behaviar you described. What exaclty is the "hole"? Multiple whitespace characters? It shouldn't effect your documents at all though because Latex removes "unneccessary" whitespaces...

      Nevertheless, I think a source formatter to be nice. I personally like to indent my \(sub)sections a little. But as you said, I would consider it as something to be done somewhen later.

       
      • Nobody/Anonymous

        I would say the same thing as Manuel. LaTeX is supposed to ignore multiple whitespaces at all.
        Never expirienced the same thing. Rather the 'opposite'... ;)

         
      • Christoph Schilling

        That last one was actually me...

         
      • Christoph Schilling

        Ok. Source formatters for TeX could lead to a big discussion. If we would ever include that, we _should_ be able to let users the interfere with that to at least a minimal extent.
        Most people don't like formatters 'destroy' their code by formatting them in a bad way, at least from their point of view...
        This is even more true for TeX than for Java code, and even there I have seen people almost starting to engage in a fight about it... ;)
        E.g, I don't indent my sections... ;)

         
    • Thomas Kuhn

      Thomas Kuhn - 2003-06-16

      ... my explanations werent too good ;) the extra whitespaces do not appear in the LaTeX document, they are just in the source. example

      text text text textomove texttomove text
      text text text text text text text text text
      text text text text text text text text text

      now i want to move the "texttomove" part at the end of the second line. the source now looks like this:

      text text text text
      text text text text text text text text text textomove texttomove
      text text text text text text text text text

      (i just hope the forum handles the line breakes right. if not, i'll send you a separate mail)!

      if you move text several times, you get some very short and some very long lines.

       
      • Christoph Schilling

        I personally use stuff like that to structure my text...
        Sometimes I like to have short lines, sometimes I use around 80 chars per line...
        This would be very difficult to include in a formatter.
        For me, cutting at word boundaries at a given line length (e.g. 80 chars) would be useful, but I wouldn't what the formatter to lengthen the lines I have chosen to stay short...
        Maybe I'm the only one that does it like this, but at least its one user opinion... ;)

         
    • Thomas Kuhn

      Thomas Kuhn - 2003-06-16

      yes. it would not be nice, if the formatter would append a set of commands on one line ... i thought, if you force a line break by pressing the enter-key, this line-break would not be touched when formatting.
      an automatic line break would only be appreciable when writing text (that might also contain commands, like \em{}).
      the question is, whether we can define rules when to automatically break the line and when not. that could be quite difficult...

       
      • Christoph Schilling

        Ok. If existing line breaks are preserved, I am still in the game... ;)
        But how would you distinguish that from your case? ;(
        You would to be able to store for every line break in the file whether it was generated by the user, pressing the enter key, or if it was generated by the editor, cutting at the line end...

         
        • Christoph Schilling

          Just had a better idea. We could include word wrapping in the editor, where the lines are broken, but line breaks are not saved, except the ones that are user-entered...
          This is a standard feature in most editors...

           
          • Manuel Prinz

            Manuel Prinz - 2003-06-17

            I still don't get how you want to keep track of which line breaks are user entered and which not... The only way I see is saving it in a different file... The problem I have is that word wrapping would mess up the line breaks as soon as the file is loaded...

            When I'm writing in Latex files I do the word wrapping just as needed. I guess a tool wouldn't be able to do it right. IMHO it would be best to include a pop-up menu entry "Wrap lines" or alike to wrap selected text (as defined in the references). A formatter which tries to reformat the whole document would be quite a task, I guess more people would complain about than rather use it.

             
            • Christoph Schilling

              Sorry my explanation was not as clear as it should have been. Actually meant the same thing as you.
              The Wrapping Feature shouldn't change the TeX document and shouldn't write any file or anything else to the filesystem, it should just be a visual gui thingy...
              Hope this is more clear... ;)

               

Log in to post a comment.