emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How to export casual letter without from and to address?
@ 2016-03-04  5:12 York Zhao
  2016-03-05  3:36 ` York Zhao
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: York Zhao @ 2016-03-04  5:12 UTC (permalink / raw)
  To: emacs-orgmode

Hi list,

I've been wondering for a while that when using org-mode to write letters, how
do you export casual a letter that doesn't have from address and to address?

Thanks in advance,

York

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

* Re: How to export casual letter without from and to address?
  2016-03-04  5:12 How to export casual letter without from and to address? York Zhao
@ 2016-03-05  3:36 ` York Zhao
  2016-03-05 10:12   ` Eric S Fraga
  2016-03-06 19:04 ` Rasmus
  2016-03-24 12:32 ` rbenit68
  2 siblings, 1 reply; 15+ messages in thread
From: York Zhao @ 2016-03-05  3:36 UTC (permalink / raw)
  To: emacs-orgmode

Please share how you write notes (casual letter without "from address" and "to
address") in Emacs org-mode, print out and give to somebody.

Thanks,\\
York

On Fri, Mar 4, 2016 at 12:12 AM, York Zhao <gtdplatform@gmail.com> wrote:
> Hi list,
>
> I've been wondering for a while that when using org-mode to write letters, how
> do you export casual a letter that doesn't have from address and to address?
>
> Thanks in advance,
>
> York

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

* Re: How to export casual letter without from and to address?
  2016-03-05  3:36 ` York Zhao
@ 2016-03-05 10:12   ` Eric S Fraga
  2016-03-05 11:22     ` H. Dieter Wilhelm
  2016-03-05 15:47     ` York Zhao
  0 siblings, 2 replies; 15+ messages in thread
From: Eric S Fraga @ 2016-03-05 10:12 UTC (permalink / raw)
  To: York Zhao; +Cc: emacs-orgmode

On Friday,  4 Mar 2016 at 22:36, York Zhao wrote:
> Please share how you write notes (casual letter without "from address" and "to
> address") in Emacs org-mode, print out and give to somebody.

If you don't have the usual elements of a letter, it is not really a
letter so simply write it as a normal org document and export it to pdf
or odt or whatever you wish to send.  org itself doesn't care!  In other
words, why use a letter exporter (koma?) if you don't want something
that looks like a letter?

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.91.1, Org release_8.3.4-626-gb62d55

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

* Re: How to export casual letter without from and to address?
  2016-03-05 10:12   ` Eric S Fraga
@ 2016-03-05 11:22     ` H. Dieter Wilhelm
  2016-03-05 15:57       ` York Zhao
  2016-03-05 15:47     ` York Zhao
  1 sibling, 1 reply; 15+ messages in thread
From: H. Dieter Wilhelm @ 2016-03-05 11:22 UTC (permalink / raw)
  To: emacs-orgmode

Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> On Friday,  4 Mar 2016 at 22:36, York Zhao wrote:
>> Please share how you write notes (casual letter without "from address" and "to
>> address") in Emacs org-mode, print out and give to somebody.
>
> If you don't have the usual elements of a letter, it is not really a
> letter so simply write it as a normal org document and export it to pdf
> or odt or whatever you wish to send.  org itself doesn't care!  In other
> words, why use a letter exporter (koma?) if you don't want something
> that looks like a letter?

Yeah, this works really convenient and near automatic, I'm also using
org for corporate meeting minutes, reports and statistics to the tax
authority (besides Koma letters of course ;-).

-- 
Best wishes
H. Dieter Wilhelm
Kelkheim, Germany

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

* Re: How to export casual letter without from and to address?
  2016-03-05 10:12   ` Eric S Fraga
  2016-03-05 11:22     ` H. Dieter Wilhelm
@ 2016-03-05 15:47     ` York Zhao
  2016-03-05 17:33       ` Marcin Borkowski
                         ` (2 more replies)
  1 sibling, 3 replies; 15+ messages in thread
From: York Zhao @ 2016-03-05 15:47 UTC (permalink / raw)
  To: York Zhao, emacs-orgmode

> Why use a letter exporter (koma?) if you don't want something that looks like
> a letter?

I wanted it to be a letter in all aspects, except that it doesn't have the "from
address" and "to address" in the header. More specifically, I want my letter
looks like:

  Hi Flora,

  Blah blah blah!

  Regards,

  York

> simply write it as a normal org document and export it to pdf or odt or
> whatever you wish to send.

The problem is, it seems to me that to export to pdf, LaTeX export is the only
way to go. But then you would have to choose a document class. Obviously you
can't use "article", nor "book". So my question may probably rephrase as: which
latex document class do you use to export the letter "as is"?

Thanks,

York

On Sat, Mar 5, 2016 at 5:12 AM, Eric S Fraga <e.fraga@ucl.ac.uk> wrote:
> On Friday,  4 Mar 2016 at 22:36, York Zhao wrote:
>> Please share how you write notes (casual letter without "from address" and "to
>> address") in Emacs org-mode, print out and give to somebody.
>
> If you don't have the usual elements of a letter, it is not really a
> letter so simply write it as a normal org document and export it to pdf
> or odt or whatever you wish to send.  org itself doesn't care!  In other
> words, why use a letter exporter (koma?) if you don't want something
> that looks like a letter?
>
> --
> : Eric S Fraga (0xFFFCF67D), Emacs 25.0.91.1, Org release_8.3.4-626-gb62d55

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

* Re: How to export casual letter without from and to address?
  2016-03-05 11:22     ` H. Dieter Wilhelm
@ 2016-03-05 15:57       ` York Zhao
  2016-03-06 10:38         ` H. Dieter Wilhelm
  0 siblings, 1 reply; 15+ messages in thread
From: York Zhao @ 2016-03-05 15:57 UTC (permalink / raw)
  To: H. Dieter Wilhelm; +Cc: emacs-orgmode

> Yeah, this works really convenient and near automatic, I'm also using org for
> corporate meeting minutes, reports and statistics to the tax authority
> (besides Koma letters of course ;-)

Same here, using org-mode for everything. But have you ever needed to print out
a letter without "from address" and "to address"? In my case, I just needed to
print a note, sign it, and pass it to somebody on a regular basis! It doesn't
make sense having to always print my home address and her address at the
beginning because it's just a casual note.

Thanks,

York

On Sat, Mar 5, 2016 at 6:22 AM, H. Dieter Wilhelm
<dieter@duenenhof-wilhelm.de> wrote:
> Eric S Fraga <e.fraga@ucl.ac.uk> writes:
>
>> On Friday,  4 Mar 2016 at 22:36, York Zhao wrote:
>>> Please share how you write notes (casual letter without "from address" and "to
>>> address") in Emacs org-mode, print out and give to somebody.
>>
>> If you don't have the usual elements of a letter, it is not really a
>> letter so simply write it as a normal org document and export it to pdf
>> or odt or whatever you wish to send.  org itself doesn't care!  In other
>> words, why use a letter exporter (koma?) if you don't want something
>> that looks like a letter?
>
> Yeah, this works really convenient and near automatic, I'm also using
> org for corporate meeting minutes, reports and statistics to the tax
> authority (besides Koma letters of course ;-).
>
> --
> Best wishes
> H. Dieter Wilhelm
> Kelkheim, Germany
>
>

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

* Re: How to export casual letter without from and to address?
  2016-03-05 15:47     ` York Zhao
@ 2016-03-05 17:33       ` Marcin Borkowski
  2016-03-05 18:56       ` Eric S Fraga
  2016-03-06  3:15       ` Nick Dokos
  2 siblings, 0 replies; 15+ messages in thread
From: Marcin Borkowski @ 2016-03-05 17:33 UTC (permalink / raw)
  To: York Zhao; +Cc: emacs-orgmode


On 2016-03-05, at 16:47, York Zhao <gtdplatform@gmail.com> wrote:

> The problem is, it seems to me that to export to pdf, LaTeX export is the only
> way to go. But then you would have to choose a document class. Obviously you
> can't use "article", nor "book". So my question may probably rephrase as: which
> latex document class do you use to export the letter "as is"?

Ha, this is in fact the main problem with LaTeX: it is not really
a "document preparation system", it is a "scientific paper preparation
system".  Any other kind of document, and LaTeX needs help.

This could be addressed in two ways:

1. Writing a "better" (i.e., more generic, not aimed towards articles
and books) LaTeX exporter.

2. Writing a ConTeXt exporter (see
http://wiki.contextgarden.net/Main_Page).

I could (and would like to) do either or both, but I'd probably have to
move to Mars to have longer days...

> Thanks,
>
> York

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University

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

* Re: How to export casual letter without from and to address?
  2016-03-05 15:47     ` York Zhao
  2016-03-05 17:33       ` Marcin Borkowski
@ 2016-03-05 18:56       ` Eric S Fraga
  2016-03-05 19:52         ` Marcin Borkowski
  2016-03-06  3:15       ` Nick Dokos
  2 siblings, 1 reply; 15+ messages in thread
From: Eric S Fraga @ 2016-03-05 18:56 UTC (permalink / raw)
  To: York Zhao; +Cc: emacs-orgmode

On Saturday,  5 Mar 2016 at 10:47, York Zhao wrote:
>> Why use a letter exporter (koma?) if you don't want something that looks like
>> a letter?
>
> I wanted it to be a letter in all aspects, except that it doesn't have the "from
> address" and "to address" in the header. More specifically, I want my letter
> looks like:
>
>   Hi Flora,
>
>   Blah blah blah!
>
>   Regards,
>
>   York
>
>> simply write it as a normal org document and export it to pdf or odt or
>> whatever you wish to send.
>
> The problem is, it seems to me that to export to pdf, LaTeX export is the only
> way to go. But then you would have to choose a document class. Obviously you
> can't use "article", nor "book". So my question may probably rephrase as: which
> latex document class do you use to export the letter "as is"?

Ah, okay, I see. Well, you could try something along the lines of:

#+begin_src org
  ,#+title:
  ,#+author:
  ,#+date:
  ,#+options: toc:nil num:nil
  ,*
  Hi Flora

  Blah blah blah!

  Regards,

  # leave some room for signature
  \vspace*{1.5cm}

  York
#+end_src

where the headline has a space after the "*".  You might want to play
with parindent and parskip LaTeX variables if you don't like the
default.

Alternatively, there may be other LaTeX styles that could give you what
you want with a little customisation although probably unlikely.  For
instance, have a look at http://www.latextemplates.com/ and maybe create
your own using the custom class example?

Finally, you could export the above (without the vspace line) to text
and then use another tool to create the PDF... such as a2ps and ps2pdf
on linux.

HTH,
eric

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.91.1, Org release_8.3.4-626-gb62d55

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

* Re: How to export casual letter without from and to address?
  2016-03-05 18:56       ` Eric S Fraga
@ 2016-03-05 19:52         ` Marcin Borkowski
  2016-03-06 19:02           ` Rasmus
  0 siblings, 1 reply; 15+ messages in thread
From: Marcin Borkowski @ 2016-03-05 19:52 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: York Zhao, emacs-orgmode


On 2016-03-05, at 19:56, Eric S Fraga <e.fraga@ucl.ac.uk> wrote:

> On Saturday,  5 Mar 2016 at 10:47, York Zhao wrote:
>>> Why use a letter exporter (koma?) if you don't want something that looks like
>>> a letter?
>>
>> I wanted it to be a letter in all aspects, except that it doesn't have the "from
>> address" and "to address" in the header. More specifically, I want my letter
>> looks like:
>>
>>   Hi Flora,
>>
>>   Blah blah blah!
>>
>>   Regards,
>>
>>   York
>>
>>> simply write it as a normal org document and export it to pdf or odt or
>>> whatever you wish to send.
>>
>> The problem is, it seems to me that to export to pdf, LaTeX export is the only
>> way to go. But then you would have to choose a document class. Obviously you
>> can't use "article", nor "book". So my question may probably rephrase as: which
>> latex document class do you use to export the letter "as is"?
>
> Ah, okay, I see. Well, you could try something along the lines of:
>
> #+begin_src org
>   ,#+title:
>   ,#+author:
>   ,#+date:
>   ,#+options: toc:nil num:nil
>   ,*
>   Hi Flora
>
>   Blah blah blah!
>
>   Regards,
>
>   # leave some room for signature
>   \vspace*{1.5cm}
>
>   York
> #+end_src
>
> where the headline has a space after the "*".  You might want to play
> with parindent and parskip LaTeX variables if you don't like the
> default.
>
> Alternatively, there may be other LaTeX styles that could give you what
> you want with a little customisation although probably unlikely.  For
> instance, have a look at http://www.latextemplates.com/ and maybe create
> your own using the custom class example?

You could also stick something like

\let\maketitle=\relax

in the preamble.  Dirty hack, but it should get rid of the
title/author/date stuff.

> HTH,
> eric

Hth,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University

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

* Re: How to export casual letter without from and to address?
  2016-03-05 15:47     ` York Zhao
  2016-03-05 17:33       ` Marcin Borkowski
  2016-03-05 18:56       ` Eric S Fraga
@ 2016-03-06  3:15       ` Nick Dokos
  2 siblings, 0 replies; 15+ messages in thread
From: Nick Dokos @ 2016-03-06  3:15 UTC (permalink / raw)
  To: emacs-orgmode

York Zhao <gtdplatform@gmail.com> writes:

>> Why use a letter exporter (koma?) if you don't want something that looks like
>> a letter?
>
> I wanted it to be a letter in all aspects, except that it doesn't have the "from
> address" and "to address" in the header. More specifically, I want my letter
> looks like:
>
>   Hi Flora,
>
>   Blah blah blah!
>
>   Regards,
>
>   York
>
>> simply write it as a normal org document and export it to pdf or odt or
>> whatever you wish to send.
>
> The problem is, it seems to me that to export to pdf, LaTeX export is the only
> way to go. But then you would have to choose a document class. Obviously you
> can't use "article", nor "book". So my question may probably rephrase as: which
> latex document class do you use to export the letter "as is"?
>

Here's a first approximation using the built-in latex letter class:

o Add the following to some appropriate initialization file:

(require 'ox-latex)
(setq simple-letter-class
      '("letter"
	"\\documentclass[11pt]{letter}"))
        
(add-to-list 'org-latex-classes simple-letter-class t)

o Then export the following:

--8<---------------cut here---------------start------------->8---
#+LATEX_CLASS: letter
#+OPTIONS: toc:nil
#+BIND: org-latex-title-command nil

#+LATEX_HEADER: \signature{York}

#+LATEX: \begin{letter}{}
Hi Flora,

Blah, blah!

#+LATEX: \closing{Regards,}
#+LATEX: \end{letter}
--8<---------------cut here---------------end--------------->8---

-- 
Nick

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

* Re: How to export casual letter without from and to address?
  2016-03-05 15:57       ` York Zhao
@ 2016-03-06 10:38         ` H. Dieter Wilhelm
  0 siblings, 0 replies; 15+ messages in thread
From: H. Dieter Wilhelm @ 2016-03-06 10:38 UTC (permalink / raw)
  To: emacs-orgmode

York Zhao <gtdplatform@gmail.com> writes:

>> Yeah, this works really convenient and near automatic, I'm also using org for
>> corporate meeting minutes, reports and statistics to the tax authority
>> (besides Koma letters of course ;-)
>
> Same here, using org-mode for everything. But have you ever needed to print out
> a letter without "from address" and "to address"? In my case, I just needed to
> print a note, sign it, and pass it to somebody on a regular basis! It doesn't
> make sense having to always print my home address and her address at the
> beginning because it's just a casual note.

When it's *not* a real letter you shouldn't use scrlttr2 as the document
class!

I suggest to have a look at the KOMA scrpage2 documentation, with this
style you have more control of the content and can create your own
*high-class* notes style.

Hope that helps

     Dieter


> Thanks,
>
> York
>
> On Sat, Mar 5, 2016 at 6:22 AM, H. Dieter Wilhelm
> <dieter@duenenhof-wilhelm.de> wrote:
>> Eric S Fraga <e.fraga@ucl.ac.uk> writes:
>>
>>> On Friday,  4 Mar 2016 at 22:36, York Zhao wrote:
>>>> Please share how you write notes (casual letter without "from address" and "to
>>>> address") in Emacs org-mode, print out and give to somebody.
>>>
>>> If you don't have the usual elements of a letter, it is not really a
>>> letter so simply write it as a normal org document and export it to pdf
>>> or odt or whatever you wish to send.  org itself doesn't care!  In other
>>> words, why use a letter exporter (koma?) if you don't want something
>>> that looks like a letter?
>>
>> Yeah, this works really convenient and near automatic, I'm also using
>> org for corporate meeting minutes, reports and statistics to the tax
>> authority (besides Koma letters of course ;-).
>>
>> --
>> Best wishes
>> H. Dieter Wilhelm
>> Kelkheim, Germany
>>
>>
>
>

-- 
Best wishes
H. Dieter Wilhelm
Kelkheim, Germany

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

* Re: How to export casual letter without from and to address?
  2016-03-05 19:52         ` Marcin Borkowski
@ 2016-03-06 19:02           ` Rasmus
  0 siblings, 0 replies; 15+ messages in thread
From: Rasmus @ 2016-03-06 19:02 UTC (permalink / raw)
  To: emacs-orgmode

Marcin Borkowski <mbork@mbork.pl> writes:

> On 2016-03-05, at 19:56, Eric S Fraga <e.fraga@ucl.ac.uk> wrote:
>
>> On Saturday,  5 Mar 2016 at 10:47, York Zhao wrote:
>>>> Why use a letter exporter (koma?) if you don't want something that looks like
>>>> a letter?
>>>
>>> I wanted it to be a letter in all aspects, except that it doesn't have the "from
>>> address" and "to address" in the header. More specifically, I want my letter
>>> looks like:
>>>
>>>   Hi Flora,
>>>
>>>   Blah blah blah!
>>>
>>>   Regards,
>>>
>>>   York
>>>
>>>> simply write it as a normal org document and export it to pdf or odt or
>>>> whatever you wish to send.
>>>
>>> The problem is, it seems to me that to export to pdf, LaTeX export is the only
>>> way to go. But then you would have to choose a document class. Obviously you
>>> can't use "article", nor "book". So my question may probably rephrase as: which
>>> latex document class do you use to export the letter "as is"?
>>
>> Ah, okay, I see. Well, you could try something along the lines of:
>>
>> #+begin_src org
>>   ,#+title:
>>   ,#+author:
>>   ,#+date:
>>   ,#+options: toc:nil num:nil
>>   ,*
>>   Hi Flora
>>
>>   Blah blah blah!
>>
>>   Regards,
>>
>>   # leave some room for signature
>>   \vspace*{1.5cm}
>>
>>   York
>> #+end_src
>>
>> where the headline has a space after the "*".  You might want to play
>> with parindent and parskip LaTeX variables if you don't like the
>> default.
>>
>> Alternatively, there may be other LaTeX styles that could give you what
>> you want with a little customisation although probably unlikely.  For
>> instance, have a look at http://www.latextemplates.com/ and maybe create
>> your own using the custom class example?
>
> You could also stick something like
>
> \let\maketitle=\relax

This only works in latex.  A backend-agnostic solution could be:

     #+options: title:nil

Though maybe it's undesirable in some other aspect.

Rasmus

-- 
May the Force be with you

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

* Re: How to export casual letter without from and to address?
  2016-03-04  5:12 How to export casual letter without from and to address? York Zhao
  2016-03-05  3:36 ` York Zhao
@ 2016-03-06 19:04 ` Rasmus
  2016-03-07  1:11   ` York Zhao
  2016-03-24 12:32 ` rbenit68
  2 siblings, 1 reply; 15+ messages in thread
From: Rasmus @ 2016-03-06 19:04 UTC (permalink / raw)
  To: emacs-orgmode

York Zhao <gtdplatform@gmail.com> writes:

> Hi list,
>
> I've been wondering for a while that when using org-mode to write letters, how
> do you export casual a letter that doesn't have from address and to address?

If you really, really want to use ox-koma-letter couldn't you just set the
addresses to @@latex:\mbox{}@@ or something similar?

I think a better solution is just to use ox-latex.

Rasmus

-- 
Dobbelt-A

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

* Re: How to export casual letter without from and to address?
  2016-03-06 19:04 ` Rasmus
@ 2016-03-07  1:11   ` York Zhao
  0 siblings, 0 replies; 15+ messages in thread
From: York Zhao @ 2016-03-07  1:11 UTC (permalink / raw)
  To: Rasmus; +Cc: emacs-orgmode

Thank you very much Eric S Fraga, H. Dieter Wilhelm, Marcin Borkowski, Nick
Dokos and Rasmus for helping me with this! I finally took Nick Dokos's approach,
and solved the problem! Here's what I did that worked:

1. In my .emacs, I added:
#+BEGIN_SRC emacs-lisp
  (add-to-list 'org-latex-classes
               '("letter" "\\documentclass[12pt]{letter}
  \\usepackage{fullpage}
  \\usepackage{setspace}"))
#+END_SRC
2. In org-mode buffer, I had the following: \\
   * Letter to Flora on 2016-03-05
   :PROPERTIES:
   :EXPORT_LATEX_CLASS: letter
   :EXPORT_LATEX_HEADER: \signature{York}
   :EXPORT_DATE: 2016-03-05 Saturday
   :EXPORT_OPTIONS: title:nil toc:nil
   :END:
   \begin{letter}{}

   \opening{Hi Flora,\\}

     Blah blah blah!

   \closing{Regards,}

   \end{letter}
3. C-c C-e l o exporting to PDF
4. Print out the PDF file


Thanks again,\\
York

On Sun, Mar 6, 2016 at 2:04 PM, Rasmus <rasmus@gmx.us> wrote:
> York Zhao <gtdplatform@gmail.com> writes:
>
>> Hi list,
>>
>> I've been wondering for a while that when using org-mode to write letters, how
>> do you export casual a letter that doesn't have from address and to address?
>
> If you really, really want to use ox-koma-letter couldn't you just set the
> addresses to @@latex:\mbox{}@@ or something similar?
>
> I think a better solution is just to use ox-latex.
>
> Rasmus
>
> --
> Dobbelt-A
>
>

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

* Re: How to export casual letter without from and to address?
  2016-03-04  5:12 How to export casual letter without from and to address? York Zhao
  2016-03-05  3:36 ` York Zhao
  2016-03-06 19:04 ` Rasmus
@ 2016-03-24 12:32 ` rbenit68
  2 siblings, 0 replies; 15+ messages in thread
From: rbenit68 @ 2016-03-24 12:32 UTC (permalink / raw)
  To: York Zhao; +Cc: emacs-orgmode

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

El 2016-03-04 06:12, York Zhao escribió:
> Hi list,
> 
> I've been wondering for a while that when using org-mode to write 
> letters, how
> do you export casual a letter that doesn't have from address and to 
> address?
> 
> Thanks in advance,
> 
> York

I would like to share a lightweight solution based on groff.

I have assembled an ob-groff.el file mostly coping the essential parts 
from ox-asymptote.el.

Once this is done, you can C-c C-c a groff source block and get the link 
to the output file in the same buffer.


Notes:

- Tested with emacs 24.5 and 25.0.92, org-plus-contrib ELPA 20160321, on 
OS 10.10.5.

- groff last version 1.22.3, which has -D<encoding> option; remove from 
:cmdline if your groff version is < 1.22.3

- pdf output is hardcoded in ob-groff.el; you can remove from there and 
add to :cmdline to get .ps or .dvi files if you prefer.

- Groff examples are from:

http://etutorials.org/Linux+systems/red+hat+linux+bible+fedora+enterprise+edition/Part+II+Using+Red+Hat+Linux/Chapter+6+Publishing+with+Red+Hat+Linux/Creating+Documents+in+Groff+or+LaTeX/

http://pipeline.lbl.gov/code/3rd_party/licenses.win/groff/1.19.2/html/mom/letters.html

I hope not to have forgotten acknowledgment to some of those wonderful 
people that write and share FOSS.

Thanks all!


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ob-groff-sample.org --]
[-- Type: text/x-lisp; name=ob-groff-sample.org, Size: 7007 bytes --]

#+STARTUP: hideblocks


#+BEGIN_SRC emacs-lisp
;; Author: Tim Krones (itsjeyd)
;; Date: Jan 14 '15 at 15:03:48Z
;; http://emacs.stackexchange.com/questions/7211/collapse-src-blocks-in-org-mode-by-default

(defvar org-blocks-hidden nil)
(defun org-toggle-blocks ()
  (interactive)
  (if org-blocks-hidden
      (org-show-block-all)
    (org-hide-block-all))
  (setq-local org-blocks-hidden (not org-blocks-hidden)))
#+END_SRC


#+BEGIN_SRC emacs-lisp
;; Author: John Kitchin
;; Date: 2016 Feb 27 at 02:12:20Z
;; http://emacs.stackexchange.com/questions/20577/org-babel-load-all-languages-on-demand
;;
(defadvice org-babel-execute-src-block (around load-language nil activate)
  "Load language if needed"
  (let ((language (org-element-property :language (org-element-at-point))))
    (unless (cdr (assoc (intern language) org-babel-load-languages))
      (add-to-list 'org-babel-load-languages (cons (intern language) t))
      (org-babel-do-load-languages 'org-babel-load-languages org-babel-load-languages))
    ad-do-it))
#+END_SRC


#+BEGIN_SRC emacs-lisp
;;;
;;; ob-groff.el --- Babel Functions for GNU troff (groff)          -*- lexical-binding: t; -*-

;; Copyright (C) 2016 rbenit68

;; Author: rbenit68 at openmailbox dot org
;; Contributors:
;; Version: 0.1
;; Keywords: org, babel, source block, groff

;; This file is not part of GNU Emacs.

;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.

;;; Commentary:

;; GNU troff (groff) from org-mode source blocks.
;; 

;;; Code:
(require 'ob)

(defvar org-babel-default-header-args:groff '())

(defvar org-babel-groff-command "groff"
  "Name of command to use for executing groff code.")

(defun org-babel-execute:groff (body params)
  "Execute a block of groff code.
This function is called by `org-babel-execute-src-block'."
  (let* ((out-file (cdr (assoc :file params)))
         (format (or (and out-file
                          (string-match ".+\\.\\(.+\\)" out-file)
                          (match-string 1 out-file))
                     "pdf"))
         (cmdline (cdr (assoc :cmdline params)))
         (in-file (org-babel-temp-file "groff-"))
         (cmd
	  (concat "groff "
		  " -Tpdf " cmdline
		  " " (org-babel-process-file-name in-file)
		  (if out-file
		      (concat
		       " > " (org-babel-process-file-name out-file))
		    )
)))
    (with-temp-file in-file
      (insert (org-babel-expand-body:generic
	       body params
	       )))
    (message cmd) (shell-command cmd)
    nil)) ;; signal that output has already been written to file

(defun org-babel-prep-session:groff (_session _params)
  "Return an error if the :session header argument is set.
groff does not support sessions."
  (error "groff sessions are nonsensical"))

(provide 'ob-groff)

;;; ob-groff.el ends here

#+end_src


#+BEGIN_SRC emacs-lisp
;; Author: Nicholas Van Horn
;; Date: 2016, last seen: Mar 23 '16 21:45CET
;; http://nicholasvanhorn.com/posts/org-structure-completion.html 

;;(eval-after-load 'org
;;  '(progn
     (add-to-list 'org-structure-template-alist
                  '("g" "#+BEGIN_SRC groff :file foo.pdf :cmdline -Dutf-8 \n?\n#+END_SRC" "<src lang=\"?\">\n\n</src>"))
;;   )
;;)
#+END_SRC


#+BEGIN_SRC groff :file letter.pdf :cmdline -Dutf-8 -mom
.AUTHOR    "RBYannick P. Guique"
.DOCTYPE    LETTER
.PRINTSTYLE TYPESET
.START
.sp 2in
.FROM
.RIGHT
.Y.P. GUIQUE
.022 Umask Road
.St-Sauveur-en-dehors-de-la-mappe, Québec
.TO
.GUILLAUME BARRIÈRES
.Minidoux Corporation
.5000 Pannes Drive
.Redmond, Virginia
.DATE
.RIGHT
August 25, 2004
.GREETING
Dear Mr. Barrières,
.PP
It has come to my attention that you have been lobbying the
US government to prohibit the use of open source software by
endeavouring to outlaw so-called "warranty free"
applications.
.PP
I feel it is my duty to inform you that the success of your
operating system with its embedded web browser relies heavily
on open source programs and protocolS, Most notably TCP/IP.
.PP
Therefore, in the interests of your corporation's fiscal health,
I strongly advise that you withdraw support for any US
legislation that would cripple or render illegal open source
development.
.CLOSING
Sincerely, 
#+END_SRC


#+BEGIN_SRC groff :file header.pdf :cmdline -Dutf-8 -mom
.de PP
.sp
.ti +0.25i
.ft R
..
.de HD
.sp
.ps \\$1
.ce
.ft B
\\$2
.ps
.ft P
.sp
..
.sp 0.67i
.HD 14 "A sample header"
.PP
We begin the text of the first paragraph here. This is indented
and formatted. We continue with the text of the first paragraph
until we want the second paragraph.
.PP
We re-issue the macro, and get the space and indent.
#+end_src


#+BEGIN_SRC groff :file lettermm.pdf :cmdline -Dutf-8 -mm
.WA "Christopher T. Craft"
999 Anyway Way
Anytown, UT 84111 USA
.WE
.IA
John W. Doe
111 Notown Blvd.
Notown, UT 84111
.IE
.LO RN "Our telephone conversation"
.LO SA "Dear Mr. Doe:"
.LT
In reference to our telephone conversation on the 4th, I am calling to
confirm our upcoming appointment on the 18th. I look forward to
discussing the merger. I believe we have a win-win situation here.
.FC "Yours Truly,"
.SG
#+END_SRC


#+BEGIN_SRC groff :file memo.pdf :cmdline -Dutf-8 -mm
.TL
Merger Technical Specifications
.AF "ABC Corporation"
.AU "Christopher Craft"
.AT "President"
.AS
This memo details the specifications for the planned merger.
.AE
.MT "Merger Description and Marching Orders"
As a result of our talks with XYZ corporation, we plan to go
forward with the merger. This document contains the following:
.BL
.LI
Schedule and time tables.
.LI
Financial statements.
.LI
Asset allocations.
.LE
.SP
Please add any corrections you have, then sign the approval line
indicated at the bottom of this sheet.
.FC
.SG
.AV "John W. Doe, XYZ Corporation President"
.AV "Sylvia Q. Public, XYZ Corporation CFO"
.NS
Everyone in the corporation.
.NE
#+END_SRC


#+BEGIN_SRC groff :file equation.pdf :cmdline -Dutf-8 -mm -e
.EQ
a ~ mark = ~ 30
.EN
.sp
.EQ
a sup 2 ~ + ~ b sup 2~lineup = ~ 1000
.EN
.sp
.EQ
x sup 3 ~ + ~ y sup 3 ~ + ~ z sup 3~lineup = ~ 1400
.EN
#+END_SRC


#+BEGIN_SRC groff :file table.pdf :cmdline -Dutf-8 -mm -t
.TS
center, box, tab(:);
c s s
c | c | c
l | l | l.
Mergers and Acquisitions Team
=
Employee:Title:Location
=_
Jones, James:Marketing Manager:New York Office
Smith, Charles:Sales Manager:Los Angeles Office
Taylor, Sarah:R&D Manager:New York Office
Walters, Mark:Information Systems Manager:Salt Lake City Office
Zur, Mike:Distribution Manager:Portland Office
.TE
#+END_SRC



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

end of thread, other threads:[~2016-03-24 13:13 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-04  5:12 How to export casual letter without from and to address? York Zhao
2016-03-05  3:36 ` York Zhao
2016-03-05 10:12   ` Eric S Fraga
2016-03-05 11:22     ` H. Dieter Wilhelm
2016-03-05 15:57       ` York Zhao
2016-03-06 10:38         ` H. Dieter Wilhelm
2016-03-05 15:47     ` York Zhao
2016-03-05 17:33       ` Marcin Borkowski
2016-03-05 18:56       ` Eric S Fraga
2016-03-05 19:52         ` Marcin Borkowski
2016-03-06 19:02           ` Rasmus
2016-03-06  3:15       ` Nick Dokos
2016-03-06 19:04 ` Rasmus
2016-03-07  1:11   ` York Zhao
2016-03-24 12:32 ` rbenit68

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).