emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Underline ONLY the first character of a word?
@ 2011-08-24 20:16 Michael Hannon
  2011-08-24 21:51 ` suvayu ali
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Michael Hannon @ 2011-08-24 20:16 UTC (permalink / raw)
  To: Org-Mode List

[-- Attachment #1: Type: text/plain, Size: 807 bytes --]

Greetings.  I've "inherited" an HTML document that uses the construct:

    <u>e</u>vent

for instance, to underline the initial 'e' in the word.  The context is
something like:

    <b>e</b>    <u>e</u>vent

to show that the choice of option 'e' corresponds to choosing an "event".

In preparation for a revision of the document, I'm trying to create a *.org
file that will duplicate as much of the original style of the HTML document as
possible (i.e., when exported to HTML).

I haven't been able to find a way to underline just the first character of a
word.  For instance,

    _e_vent

doesn't produce what I want.  I tried:

    _e_ vent

and that underlined the 'e' but, of course, left an unwanted space.

Is there some way to do this?  A better way?

Thanks,

-- Mike

[-- Attachment #2: Type: text/html, Size: 1158 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Underline ONLY the first character of a word?
  2011-08-24 20:16 Underline ONLY the first character of a word? Michael Hannon
@ 2011-08-24 21:51 ` suvayu ali
  2011-08-24 22:44   ` Michael Hannon
  2011-08-24 23:28 ` Nick Dokos
  2011-08-26  5:59 ` Jambunathan K
  2 siblings, 1 reply; 12+ messages in thread
From: suvayu ali @ 2011-08-24 21:51 UTC (permalink / raw)
  To: Michael Hannon; +Cc: Org-Mode List

On Wed, Aug 24, 2011 at 10:16 PM, Michael Hannon <jm_hannon@yahoo.com> wrote:
> I haven't been able to find a way to underline just the first character of a
> word.  For instance,
>
>     _e_vent
>
> doesn't produce what I want.  I tried:
>
>     _e_ vent
>
> and that underlined the 'e' but, of course, left an unwanted space.
>
> Is there some way to do this?  A better way?
>

I don't believe you can.

-- 
Suvayu

Open source is the future. It sets us free.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Underline ONLY the first character of a word?
  2011-08-24 21:51 ` suvayu ali
@ 2011-08-24 22:44   ` Michael Hannon
  2011-08-24 22:50     ` John Hendy
  2011-08-25 21:30     ` Michael Hannon
  0 siblings, 2 replies; 12+ messages in thread
From: Michael Hannon @ 2011-08-24 22:44 UTC (permalink / raw)
  To: suvayu ali; +Cc: Org-Mode List

[-- Attachment #1: Type: text/plain, Size: 992 bytes --]

Thanks, Suvayu.  I'll bet somebody on this list could knock out 400 lines of elisp code that would do the trick, but I'm happy to punt on it.  It isn't that important a feature.

-- Mike



>________________________________
>From: suvayu ali <fatkasuvayu+linux@gmail.com>
>To: Michael Hannon <jm_hannon@yahoo.com>
>Cc: Org-Mode List <emacs-orgmode@gnu.org>
>Sent: Wednesday, August 24, 2011 2:51 PM
>Subject: Re: [O] Underline ONLY the first character of a word?
>
>On Wed, Aug 24, 2011 at 10:16 PM, Michael Hannon <jm_hannon@yahoo.com> wrote:
>> I haven't been able to find a way to underline just the first character of a
>> word.  For instance,
>>
>>     _e_vent
>>
>> doesn't produce what I want.  I tried:
>>
>>     _e_ vent
>>
>> and that underlined the 'e' but, of course, left an unwanted space.
>>
>> Is there some way to do this?  A better way?
>>
>
>I don't believe you can.
>
>-- 
>Suvayu
>
>Open source is the future. It sets us free.
>
>
>
>

[-- Attachment #2: Type: text/html, Size: 1918 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Underline ONLY the first character of a word?
  2011-08-24 22:44   ` Michael Hannon
@ 2011-08-24 22:50     ` John Hendy
  2011-08-25 21:30     ` Michael Hannon
  1 sibling, 0 replies; 12+ messages in thread
From: John Hendy @ 2011-08-24 22:50 UTC (permalink / raw)
  To: Michael Hannon; +Cc: Org-Mode List

>
> ________________________________
> From: suvayu ali <fatkasuvayu+linux@gmail.com>
> To: Michael Hannon <jm_hannon@yahoo.com>
> Cc: Org-Mode List <emacs-orgmode@gnu.org>
> Sent: Wednesday, August 24, 2011 2:51 PM
> Subject: Re: [O] Underline ONLY the first character of a word?
>
> On Wed, Aug 24, 2011 at 10:16 PM, Michael Hannon <jm_hannon@yahoo.com>
> wrote:
>> I haven't been able to find a way to underline just the first character of
>> a
>> word.  For instance,
>>
>>     _e_vent
>>
>> doesn't produce what I want.  I tried:
>>
>>     _e_ vent
>>
>> and that underlined the 'e' but, of course, left an unwanted space.
>>
>> Is there some way to do this?  A better way?
>>

What are you exporting to? I almost exclusively use LaTeX, so I will
take to forcing something like this on the rare occasion I need it:

,-----
| \underline{T}his is a test.
| Ti\emph{k}Z
`-----


John

>
> I don't believe you can.
>
> --
> Suvayu
>
> Open source is the future. It sets us free.
>
>
>
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Underline ONLY the first character of a word?
  2011-08-24 20:16 Underline ONLY the first character of a word? Michael Hannon
  2011-08-24 21:51 ` suvayu ali
@ 2011-08-24 23:28 ` Nick Dokos
  2011-08-24 23:34   ` Nick Dokos
  2011-08-25  0:26   ` Nick Dokos
  2011-08-26  5:59 ` Jambunathan K
  2 siblings, 2 replies; 12+ messages in thread
From: Nick Dokos @ 2011-08-24 23:28 UTC (permalink / raw)
  To: Michael Hannon; +Cc: nicholas.dokos, Org-Mode List

Michael Hannon <jm_hannon@yahoo.com> wrote:

> Greetings.  I've "inherited" an HTML document that uses the construct:
> 
>     <u>e</u>vent
> 
> for instance, to underline the initial 'e' in the word.  The context is
> something like:
> 
>     <b>e</b>    <u>e</u>vent
> 
> to show that the choice of option 'e' corresponds to choosing an "event".
> 
> In preparation for a revision of the document, I'm trying to create a *.org
> file that will duplicate as much of the original style of the HTML document as
> possible (i.e., when exported to HTML).
> 
> I haven't been able to find a way to underline just the first character of a
> word.  For instance,
> 
>     _e_vent
> 
> doesn't produce what I want.  I tried:
> 
>     _e_ vent
> 
> and that underlined the 'e' but, of course, left an unwanted space.
> 
> Is there some way to do this?  A better way?
> 

Not without some code I think.

I can *almost* do it with babel, but there is some manual work involved.
For example, in the following file:

--8<---------------cut here---------------start------------->8---

* Table                                                 :noexport:

#+TBLNAME: actions
| abbrev | action          |
|--------+-----------------|
| a      | actionable      |
| b      | bibulous        |
| c      | califragilistic |


#+begin_src python :results output :exports none :var table=actions

  print "* Results"
  print "#+begin_html"
  for row in table:
      print "<b>%s</b>  <u>%s</u>%s<br/>" % (row[0], row[1][0:1], row[1][1:])
  
  print "#+end_html"
#+end_src

--8<---------------cut here---------------end--------------->8---

I can evaluate the source block with C-c C-c and get a results block
like this[fn:1]:

--8<---------------cut here---------------start------------->8---
#+results:
#+begin_example
* Results
#+begin_html
<b>a</b>  <u>a</u>ctionable<br/>
<b>b</b>  <u>b</u>ibulous<br/>
<b>c</b>  <u>c</u>alifragilistic<br/>
#+end_html
#+end_example
--8<---------------cut here---------------end--------------->8---

then manually delete the #+{begin,end}_example lines and *then* export the
resulting file.

You might also be able to do something with radio tables or dynamic blocks
but I have not gone down that path.

Nick

Footnotes:

[fn:1] You might have to do something like this

     (setq  org-babel-min-lines-for-block-output 1)

to convince babel to produce an example block rather than colon-preceded
literals.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Underline ONLY the first character of a word?
  2011-08-24 23:28 ` Nick Dokos
@ 2011-08-24 23:34   ` Nick Dokos
  2011-08-26  8:35     ` Carsten Dominik
  2011-08-25  0:26   ` Nick Dokos
  1 sibling, 1 reply; 12+ messages in thread
From: Nick Dokos @ 2011-08-24 23:34 UTC (permalink / raw)
  To: Michael Hannon; +Cc: nicholas.dokos, emacs-orgmode

Nick Dokos <nicholas.dokos@hp.com> wrote:

> Not without some code I think.
> 

D'oh - as John Hendy points out, you can do it by hand:

--8<---------------cut here---------------start------------->8---

#+begin_html
 <b>a</b>  <u>a</u>ctionable<br/>
 <b>b</b>  <u>b</u>ibulous<br/>
 <b>c</b>  <u>c</u>alifragilistic<br/>
#+end_html
--8<---------------cut here---------------end--------------->8---

It always amazes me how fixated I can get on the wrong approach.

Nick

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Underline ONLY the first character of a word?
  2011-08-24 23:28 ` Nick Dokos
  2011-08-24 23:34   ` Nick Dokos
@ 2011-08-25  0:26   ` Nick Dokos
  1 sibling, 0 replies; 12+ messages in thread
From: Nick Dokos @ 2011-08-25  0:26 UTC (permalink / raw)
  To: Michael Hannon; +Cc: nicholas.dokos, emacs-orgmode

Here is an amusing aside[fn:1]. Take the org file I posted previously:

--8<---------------cut here---------------start------------->8---

* Table                                                 :noexport:

#+TBLNAME: actions
| abbrev | action          |
|--------+-----------------|
| a      | actionable      |
| b      | bibulous        |
| c      | califragilistic |


#+begin_src python :results output :exports none :var table=actions

  print "* Results"
  print "#+begin_html"
  for row in table:
      print "<b>%s</b>  <u>%s</u>%s<br/>" % (row[0], row[1][0:1], row[1][1:])
  
  print "#+end_html"
#+end_src
--8<---------------cut here---------------end--------------->8---



If I export this to html, I get nothing in the body because of the :noexport: tag.
But if I evaluate the source block:



--8<---------------cut here---------------start------------->8---

* Table                                                                                                       :noexport:

#+TBLNAME: actions
| abbrev | action          |
|--------+-----------------|
| a      | actionable      |
| b      | bibulous        |
| c      | califragilistic |


#+begin_src python :results output :exports none :var table=actions
  print "* Results"
  print "#+begin_html"
  for row in table:
      print "<b>%s</b>  <u>%s</u>%s<br/>" % (row[0],
                                             row[1][0:1],
                                             row[1][1:])
  
  print "#+end_html"
  
#+end_src

#+results:
#+begin_example
* Results
#+begin_html
<b>a</b>  <u>a</u>ctionable<br/>
<b>b</b>  <u>b</u>ibulous<br/>
<b>c</b>  <u>c</u>alifragilistic<br/>
#+end_html
#+end_example
--8<---------------cut here---------------end--------------->8---



and then export (*without* the manual excision of the #+{begin,end}_example),
I get:



--8<---------------cut here---------------start------------->8---
<div id="outline-container-1" class="outline-2">
<h2 id="sec-1"><span class="section-number-2">1</span> Results </h2>
<div class="outline-text-2" id="text-1">


<b>a</b>  <u>a</u>ctionable<br/>
<b>b</b>  <u>b</u>ibulous<br/>
<b>c</b>  <u>c</u>alifragilistic<br/>

</div>
</div>
--8<---------------cut here---------------end--------------->8---



which surprised me: the "* Results" line is interpreted as a new headline
during export, despite the fact that it appears within an example block
(that's probably a consequence of the  ordering of actions
in org-export-preprocess-string [fn:2]): the noexport tag strips everything
to  the "* Results" line, which I guess is surprising at first but makes sense,
and the #+end_example line is silently discarded).

Oh, no! Look what I've done: András will now insist that the whole thing has
to be either documented completely or thrown out bodily :-)

With-tongue-firmly-in-cheek-ly yours,
Nick

Footnotes:

[fn:1] For some value of "amusing".

[fn:2] See somewhere in this thread: http://thread.gmane.org/gmane.emacs.orgmode/46021.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Underline ONLY the first character of a word?
  2011-08-24 22:44   ` Michael Hannon
  2011-08-24 22:50     ` John Hendy
@ 2011-08-25 21:30     ` Michael Hannon
  1 sibling, 0 replies; 12+ messages in thread
From: Michael Hannon @ 2011-08-25 21:30 UTC (permalink / raw)
  To: Org-Mode List

[-- Attachment #1: Type: text/plain, Size: 136 bytes --]

Thanks to Suvayu, John, and Nick (in chronological order) for thoughtful comments on this.  I'm still considering my options.

-- Mike

[-- Attachment #2: Type: text/html, Size: 329 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Underline ONLY the first character of a word?
  2011-08-24 20:16 Underline ONLY the first character of a word? Michael Hannon
  2011-08-24 21:51 ` suvayu ali
  2011-08-24 23:28 ` Nick Dokos
@ 2011-08-26  5:59 ` Jambunathan K
  2 siblings, 0 replies; 12+ messages in thread
From: Jambunathan K @ 2011-08-26  5:59 UTC (permalink / raw)
  To: Michael Hannon; +Cc: Org-Mode List


See http://www.mail-archive.com/emacs-orgmode@gnu.org/msg45991.html

Just, creating a backlink to the other thread. John Hendy created the
forward link.

> Greetings.  I've "inherited" an HTML document that uses the
> construct:
>
>     <u>e</u>vent
>
> for instance, to underline the initial 'e' in the word.  The context
> is
> something like:
>
>     <b>e</b>    <u>e</u>vent
>
> to show that the choice of option 'e' corresponds to choosing an
> "event".
>
> In preparation for a revision of the document, I'm trying to create a
> *.org
> file that will duplicate as much of the original style of the HTML
> document as
> possible (i.e., when exported to HTML).
>
> I haven't been able to find a way to underline just the first
> character of a
> word.  For instance,
>
>     _e_vent
>
> doesn't produce what I want.  I tried:
>
>     _e_ vent
>
> and that underlined the 'e' but, of course, left an unwanted space.
>
> Is there some way to do this?  A better way?
>
> Thanks,
>
> -- Mike
>
>
>

-- 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Underline ONLY the first character of a word?
  2011-08-24 23:34   ` Nick Dokos
@ 2011-08-26  8:35     ` Carsten Dominik
  2011-08-28  9:41       ` Niels Giesen
  2011-08-29  3:48       ` Michael Hannon
  0 siblings, 2 replies; 12+ messages in thread
From: Carsten Dominik @ 2011-08-26  8:35 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: Michael Hannon, emacs-orgmode

Hi,

I don't think the following trick has come up yet.  If you are
only exporting to HTML, you can do:

@<u>e@</u>vent

HTH

- Carsten

On 25.8.2011, at 01:34, Nick Dokos wrote:

> Nick Dokos <nicholas.dokos@hp.com> wrote:
> 
>> Not without some code I think.
>> 
> 
> D'oh - as John Hendy points out, you can do it by hand:
> 
> --8<---------------cut here---------------start------------->8---
> 
> #+begin_html
> <b>a</b>  <u>a</u>ctionable<br/>
> <b>b</b>  <u>b</u>ibulous<br/>
> <b>c</b>  <u>c</u>alifragilistic<br/>
> #+end_html
> --8<---------------cut here---------------end--------------->8---
> 
> It always amazes me how fixated I can get on the wrong approach.
> 
> Nick
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Underline ONLY the first character of a word?
  2011-08-26  8:35     ` Carsten Dominik
@ 2011-08-28  9:41       ` Niels Giesen
  2011-08-29  3:48       ` Michael Hannon
  1 sibling, 0 replies; 12+ messages in thread
From: Niels Giesen @ 2011-08-28  9:41 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Michael Hannon, nicholas.dokos, emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1132 bytes --]

What about using something well-structured like a table or a (definition)
list and CSS :first-letter pseudoselector and text-decoration: underline?

e.g.

td:first-child {
  font-weight:bold;
}
td~td:first-letter {
  text-decoration:underline;
}

for a two-column table.

On Fri, Aug 26, 2011 at 10:35 AM, Carsten Dominik <carsten.dominik@gmail.com
> wrote:

> Hi,
>
> I don't think the following trick has come up yet.  If you are
> only exporting to HTML, you can do:
>
> @<u>e@</u>vent
>
> HTH
>
> - Carsten
>
> On 25.8.2011, at 01:34, Nick Dokos wrote:
>
> > Nick Dokos <nicholas.dokos@hp.com> wrote:
> >
> >> Not without some code I think.
> >>
> >
> > D'oh - as John Hendy points out, you can do it by hand:
> >
> > --8<---------------cut here---------------start------------->8---
> >
> > #+begin_html
> > <b>a</b>  <u>a</u>ctionable<br/>
> > <b>b</b>  <u>b</u>ibulous<br/>
> > <b>c</b>  <u>c</u>alifragilistic<br/>
> > #+end_html
> > --8<---------------cut here---------------end--------------->8---
> >
> > It always amazes me how fixated I can get on the wrong approach.
> >
> > Nick
> >
>
>
>


-- 
http://pft.github.com

[-- Attachment #2: Type: text/html, Size: 2025 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Underline ONLY the first character of a word?
  2011-08-26  8:35     ` Carsten Dominik
  2011-08-28  9:41       ` Niels Giesen
@ 2011-08-29  3:48       ` Michael Hannon
  1 sibling, 0 replies; 12+ messages in thread
From: Michael Hannon @ 2011-08-29  3:48 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 176 bytes --]

> I don't think the following trick has come up yet.  If you are
> only exporting to HTML, you can do:
> 
> @<u>e@</u>vent

Thanks, Carsten.  That works nicely.

-- Mike

[-- Attachment #2: Type: text/html, Size: 386 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2011-08-29  3:48 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-24 20:16 Underline ONLY the first character of a word? Michael Hannon
2011-08-24 21:51 ` suvayu ali
2011-08-24 22:44   ` Michael Hannon
2011-08-24 22:50     ` John Hendy
2011-08-25 21:30     ` Michael Hannon
2011-08-24 23:28 ` Nick Dokos
2011-08-24 23:34   ` Nick Dokos
2011-08-26  8:35     ` Carsten Dominik
2011-08-28  9:41       ` Niels Giesen
2011-08-29  3:48       ` Michael Hannon
2011-08-25  0:26   ` Nick Dokos
2011-08-26  5:59 ` Jambunathan K

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).