emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Underline ONLY the first character of a word?


From: Nick Dokos
Subject: Re: [O] Underline ONLY the first character of a word?
Date: Wed, 24 Aug 2011 19:28:19 -0400

Michael Hannon <address@hidden> 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]