Discussion:
[Docutils-users] Letters in reST?
Matěj Cepl
2016-04-25 12:00:37 UTC
Permalink
Hi,

I am using LyX and LaTeX class scrlttr2 for writing my business
letters. However, whenever I start to write a new letter, I am
painfully reminded that it is actually last use of LyX I have
(with the help of zrst2* tools I can now use Zotero for writing
documents in rST; thank you!). Of course, I could easily write
those letters just in a plain LaTeX in my $EDITOR, but it seems
that highly form-like documents like business letters could be
with benefit written in rST. I guess it is just question of
defining proper roles and some kind of templating.

As an example this document in LyX
Loading Image...
(with some details obscured, of course), leads more or less to
this generated LaTeX
https://mcepl.fedorapeople.org/tmp/lorem-ipsum.tex, which ends
up in this PDF
https://mcepl.fedorapeople.org/tmp/lorem-ipsum.pdf

Did anybody do such macros? Is it necessary to use
a preprocessor or would be possible to do just macros in
.docutils or some other configuration file?

Thank you for any tips,

Matěj
--
https://matej.ceplovi.cz/blog/, Jabber: ***@ceplovi.cz
GPG Finger: 89EF 4BC6 288A BF43 1BAB 25C3 E09F EF25 D964 84AC

Ask yourself whether you’ve really obtained fullness of the Holy
Spirit, followed by gifts needed for your service.
-- Francis MacNutt


------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Docutils-users mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-users

Please use "Reply
Guenter Milde
2016-04-26 19:26:52 UTC
Permalink
Ahoj,
Post by Matěj Cepl
I am using LyX and LaTeX class scrlttr2 for writing my business
letters. However, whenever I start to write a new letter, I am
painfully reminded that it is actually last use of LyX I have
(with the help of zrst2* tools I can now use Zotero for writing
documents in rST; thank you!). Of course, I could easily write
those letters just in a plain LaTeX in my $EDITOR, but it seems
that highly form-like documents like business letters could be
with benefit written in rST. I guess it is just question of
defining proper roles and some kind of templating.
If you are prepared to

* do some "creative writing" (using rST objects for different purpose via
re-defining the generated LaTeX macros)

* use some roles

* use a "heavy" custom LaTeX preamble,

* eventually use some raw LaTeX

this should be possible.

Remember, you can set the documentclass, a custom template file, a custom
preamble, loaded packages etc in the config file or via command line
options. (See the latex writer doc which also applies to the XeTeX writer
(generating LaTeX suited for LuaLaTeX and XeLaTeX processing.)


Some hints:

* all fixed data can go into the custom preamble::

\setkomavar{fromname}{Matěj Cepl}

\setkomavar{fromaddress}{27 Golden Leaf Lane\\
A5G 28 Minas Tirith 5}

\setkomavar{fromemail}{***@example.com}

\setkomavar{signature}{Matěj Cepl}

\setkomavar{place}{V Praze}

\setkomavar{date}{\today}

\setkomavar{signature}{Matěj Cepl}

* With some role definitions and redefinitions in the preamble::

\newcommand{\DUroleopening}{\opening}
\newcommand{\DUroleclosing}{\closing}
\newcommand{\DUrolesubject}{\setkomavar{subject}}

you can write::

.. role:: subject
.. role:: opening
.. role:: closing

:subject:`Žádost o změnu registrace smlouvy`

.. raw:: latex

\begin{letter}{ČSOB Penzijní společnost\\
Radlická 333/150\\
150 57 Praha 5\\
tel.: +420 495 800 600\\
email: \url{***@csob.cz}}

:opening:`Žádost o změnu registrace smlouvy`

Letter content

:closing:`S pozdravem`


There is currently no easy way to get line-breaks in exported LaTeX.

Handling of the :address: docinfo field is currently hard-coded towards use
in an article. This could be improved to allow for a more versatile use by
intermediate macros...


Günter
Matěj Cepl
2016-04-26 22:12:17 UTC
Permalink
Post by Guenter Milde
If you are prepared to
Thanks for hints: I will take a look.

Matěj
--
https://matej.ceplovi.cz/blog/, Jabber: ***@ceplovi.cz
GPG Finger: 89EF 4BC6 288A BF43 1BAB 25C3 E09F EF25 D964 84AC

"Goodbye," said the fox. "And now here is my secret, a very
simple secret: It is only with the heart that one can see
rightly; what is essential is invisible to the eye."
-- Antoine de Saint-Exupery
Loading...