Justify and/or Hyphenate Plain Text

Discussion in 'HTML' started by Roy Schestowitz, Oct 16, 2005.

  1. This may be somewhat unrelated to this group, but I can't think of where
    else it fits. Is it possible to take text such as the text I am composing
    at the very moment and then, given some value of width, fit it to a rect-
    angular block where both justification (using space insertion) and hyphe-
    nation (a la LaTeX) are determined wisely? I can think of possible
    issues such as spellchecking and indexing, but they don't appear to deter
    me much.

    Many thanks,

    Roy
     
    Roy Schestowitz, Oct 16, 2005
    #1
    1. Advertising

  2. Roy Schestowitz

    Toby Inkster Guest

    Roy Schestowitz wrote:

    > Is it possible to take text such as the text I am composing at the very
    > moment and then, given some value of width, fit it to a rectangular
    > block where both justification (using space insertion) and hyphenation
    > (a la LaTeX) are determined wisely?


    In text/plain or text/html?

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
     
    Toby Inkster, Oct 16, 2005
    #2
    1. Advertising

  3. Re: Justify and/or Hyphenate Plain Text - Tool Needed

    __/ [Toby Inkster] on Sunday 16 October 2005 19:07 \__

    > Roy Schestowitz wrote:
    >
    >> Is it possible to take text such as the text I am composing at the very
    >> moment and then, given some value of width, fit it to a rectangular
    >> block where both justification (using space insertion) and hyphenation
    >> (a la LaTeX) are determined wisely?

    >
    > In text/plain or text/html?


    Just text would do. If I was ever to use that, it would serve UseNet
    postings. I simply seek a small (and of course free as in beer) tool that
    can do the simple task. Space insertion is simple, so hyphenation would be
    a plus...

    Many thanks in advance if you can suggest something, Toby. If nothing
    exists, I might have to write my own, but I would rather not.

    Roy
     
    Roy Schestowitz, Oct 17, 2005
    #3
  4. Roy Schestowitz

    rossz Guest

    Roy Schestowitz wrote:
    > This may be somewhat unrelated to this group, but I can't think of where
    > else it fits. Is it possible to take text such as the text I am composing
    > at the very moment and then, given some value of width, fit it to a rect-
    > angular block where both justification (using space insertion) and hyphe-
    > nation (a la LaTeX) are determined wisely? I can think of possible
    > issues such as spellchecking and indexing, but they don't appear to deter
    > me much.


    Automagically, not really. You can manually insert the soft hyphen
    (­) into your document. IE and Opera support it, Firefox as of 1.04
    does not. I have not tested it on a recent version of Firefox.

    It is conceivable to write a script (perl or php) that takes text input
    and spits it out with soft hyphens embedded. I remember there being
    some basic rules for hyphenation, with a small list of exceptions for
    words that did not fit into the rules.

    --
    Rossz
    God kills a kitten each time someone uses Internet Explorer
     
    rossz, Oct 17, 2005
    #4
  5. Roy Schestowitz

    rossz Guest

    rossz wrote:
    > Roy Schestowitz wrote:
    >
    >>This may be somewhat unrelated to this group, but I can't think of where
    >>else it fits. Is it possible to take text such as the text I am composing
    >>at the very moment and then, given some value of width, fit it to a rect-
    >>angular block where both justification (using space insertion) and hyphe-
    >>nation (a la LaTeX) are determined wisely? I can think of possible
    >>issues such as spellchecking and indexing, but they don't appear to deter
    >>me much.

    >
    >
    > Automagically, not really. You can manually insert the soft hyphen
    > (­) into your document. IE and Opera support it, Firefox as of 1.04
    > does not. I have not tested it on a recent version of Firefox.


    I just did a test. Soft hyphens are still not supported in Firefox 1.0.7.

    --
    Rossz
     
    rossz, Oct 17, 2005
    #5
  6. Re: Justify and/or Hyphenate ASCII Input

    __/ [rossz] on Monday 17 October 2005 06:58 \__

    > Roy Schestowitz wrote:
    >> This may be somewhat unrelated to this group, but I can't think of where
    >> else it fits. Is it possible to take text such as the text I am composing
    >> at the very moment and then, given some value of width, fit it to a rect-
    >> angular block where both justification (using space insertion) and hyphe-
    >> nation (a la LaTeX) are determined wisely? I can think of possible
    >> issues such as spellchecking and indexing, but they don't appear to deter
    >> me much.

    >
    > Automagically, not really. You can manually insert the soft hyphen
    > (­) into your document. IE and Opera support it, Firefox as of 1.04
    > does not. I have not tested it on a recent version of Firefox.
    >
    > It is conceivable to write a script (perl or php) that takes text input
    > and spits it out with soft hyphens embedded. I remember there being
    > some basic rules for hyphenation, with a small list of exceptions for
    > words that did not fit into the rules.
    >
    > ===
    >
    > I just did a test. Soft hyphens are still not supported in Firefox 1.0.7.


    I am sorry to be such a disappointment, but perhaps I was not explicit
    enough as to what I was trying to apply this to and what I sought to
    achieve. I imagined that the subject line would be a good clarification,
    but the context (newsgroup) evaded me.

    I am hoping to be able to apply this method to text such as that which I
    write in this very message, i.e. simple and plain ASCII. I want to have a
    little tool that will take as input this text and give me something that
    appears nicer in terms of layout.

    Roy

    --
    Roy S. Schestowitz | make install -not war
    http://Schestowitz.com | SuSE Linux | PGP-Key: 74572E8E
    7:30am up 52 days 19:44, 4 users, load average: 0.56, 0.72, 0.58
    http://iuron.com - next generation of search paradigms
     
    Roy Schestowitz, Oct 17, 2005
    #6
  7. Roy Schestowitz

    Toby Inkster Guest

    Re: Justify and/or Hyphenate Plain Text - Tool Needed

    Roy Schestowitz wrote:

    > Many thanks in advance if you can suggest something, Toby. If nothing
    > exists, I might have to write my own, but I would rather not.


    For a moment I though /usr/bin/fmt might do it, but it appears not.

    I think you may have to write your own script, but most of the tricky
    stuff has already been done for you. Perl's Text::Hyphenate followed by
    Text::Format ought to do it.

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
     
    Toby Inkster, Oct 17, 2005
    #7
  8. Re: Justify and/or Hyphenate ASCII Input

    Roy Schestowitz <> wrote:

    > I am sorry to be such a disappointment, but perhaps I was not explicit
    > enough as to what I was trying to apply this to and what I sought to
    > achieve. I imagined that the subject line would be a good
    > clarification, but the context (newsgroup) evaded me.


    Well, your question was completely off-topic. Many people in alt.html
    understand this as a catchall group, but that's rather unconstructive.
    A group for anything isn't suitable for anything.

    > I am hoping to be able to apply this method to text such as that which
    > I write in this very message, i.e. simple and plain ASCII.


    So why don't you try and find a group that discusses such matters? The
    group comp.text comes into my mind. Of course, you would need to explain
    your problem and situation clearly there, in order to get useful answers.
    You haven't even told anything about the environment (BSD or System V
    UNIX?).

    > I want to
    > have a little tool that will take as input this text and give me
    > something that appears nicer in terms of layout.


    You would need to define "little", "nicer", and "layout". But there are
    surely programs that do such things - they have existed for decades, long
    before HTML was invented. Justification of plain text was found to be bad
    idea long ago, but surely there is software for it.

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
     
    Jukka K. Korpela, Oct 17, 2005
    #8
  9. Re: Justify and/or Hyphenate ASCII Input

    __/ [Jukka K. Korpela] on Monday 17 October 2005 12:21 \__

    > Roy Schestowitz <> wrote:
    >
    >> I am sorry to be such a disappointment, but perhaps I was not explicit
    >> enough as to what I was trying to apply this to and what I sought to
    >> achieve. I imagined that the subject line would be a good
    >> clarification, but the context (newsgroup) evaded me.

    >
    > Well, your question was completely off-topic. Many people in alt.html
    > understand this as a catchall group, but that's rather unconstructive.
    > A group for anything isn't suitable for anything.



    You're quite right, but I see this newsgroup as somewhat of a community with
    content composition skills. I don't just see it as a very narrow and
    focused group where posts can end up reaching a point of complete halt. But
    overall, I agree, I should have been more selective.


    >> I am hoping to be able to apply this method to text such as that which
    >> I write in this very message, i.e. simple and plain ASCII.

    >
    > So why don't you try and find a group that discusses such matters? The
    > group comp.text comes into my mind. Of course, you would need to explain
    > your problem and situation clearly there, in order to get useful answers.
    > You haven't even told anything about the environment (BSD or System V
    > UNIX?).



    What I had in mine is just some simple C (or equiv.) function that I can
    compile regardless of the platform. Introduction of the O/S did not appear
    to me as a necessity.


    >> I want to
    >> have a little tool that will take as input this text and give me
    >> something that appears nicer in terms of layout.

    >
    > You would need to define "little", "nicer", and "layout". But there are
    > surely programs that do such things - they have existed for decades, long
    > before HTML was invented. Justification of plain text was found to be bad
    > idea long ago, but surely there is software for it.



    Thanks, I'll carry on looking.

    Roy

    --
    Roy S. Schestowitz | Y |-(1^2)|^(1/2)+1 K
    http://Schestowitz.com | SuSE Linux | PGP-Key: 74572E8E
    1:50pm up 53 days 2:04, 4 users, load average: 0.36, 0.53, 0.43
    http://iuron.com - next generation of search paradigms
     
    Roy Schestowitz, Oct 17, 2005
    #9
  10. Re: Justify and/or Hyphenate - SOLVED

    __/ [Roy Schestowitz] on Sunday 16 October 2005 18:57 \__

    > This may be somewhat unrelated to this group, but I can't think of where
    > else it fits. Is it possible to take text such as the text I am composing
    > at the very moment and then, given some value of width, fit it to a rect-
    > angular block where both justification (using space insertion) and hyphe-
    > nation (a la LaTeX) are determined wisely? I can think of possible
    > issues such as spellchecking and indexing, but they don't appear to deter
    > me much.
    >
    > Many thanks,
    >
    > Roy



    Got it!! Works beautifully too and use the TeX modules...

    Project homepage: http://freshmeat.net/projects/paradj/

    First test run:

    roy@BAINE:~/Desktop/paradj> echo 'lskdfhsjdfbjsdbfsdhfidsjfodshfds nfi
    dysou;f udsidf hjdsfkdsfvbids fisyd fiuds fuyds fguods fgousd djs hfuds
    fugds hfuhsd fvjsd foidsfgodsu fioshg fds if' >1

    roy@BAINE:~/Desktop/paradj> perl paradj.pl --width=40 -h -r 1
    lskdfhsjdfbjsdbfsdhfidsjfodshfds nfi
    dysou;f udsidf hjdsfkdsfvbids fisyd fi-
    uds fuyds fguods fgousd djs hfuds fugds
    hfuhsd fvjsd foidsfgodsu fioshg fds if

    Thanks for your input, Toby. You had me look a little more closely into
    Perl.

    There are also Python equivalent(s):

    tp://freshmeat.net/projects/pyhnj/


    Roy

    --
    Roy S. Schestowitz | Open the Gate$ to Hell
    http://Schestowitz.com | SuSE Linux | PGP-Key: 74572E8E
    6:00am up 53 days 18:14, 8 users, load average: 0.14, 0.44, 0.67
    http://iuron.com - next generation of search paradigms
     
    Roy Schestowitz, Oct 18, 2005
    #10
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Wilson

    Right justify text in textbox in web page

    John Wilson, Oct 8, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    6,502
    John Wilson
    Oct 8, 2005
  2. Bruno

    Text-align: justify

    Bruno, Oct 16, 2003, in forum: HTML
    Replies:
    2
    Views:
    531
    nice.guy.nige
    Oct 17, 2003
  3. Deryck
    Replies:
    10
    Views:
    1,037
    Jukka K. Korpela
    Aug 14, 2004
  4. mike

    justify text and PDF::API2 module

    mike, Feb 17, 2005, in forum: Perl Misc
    Replies:
    0
    Views:
    121
Loading...

Share This Page