emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* 2-column mode for many cooking recipes
@ 2018-02-28  9:56 Sharon Kimble
  2018-02-28 12:01 ` Eric S Fraga
  2018-03-01 12:07 ` Sharon Kimble
  0 siblings, 2 replies; 7+ messages in thread
From: Sharon Kimble @ 2018-02-28  9:56 UTC (permalink / raw)
  To: org-mode-email

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


I have this as a recipe -

--8<---------------cut here---------------start------------->8---
** Date Bread
\index[pies]{Date bread}\index[menu]{Bread!date}\index[cook]{Bake!date bread}\index{Fruit!dates}
/12 ounces stoned dates/\\
/1 teaspoonful bicarbonate of soda/\\
/1 cupful boiling water/\\
/4 ounces margarine/\\
/1 egg/\\
/2 cups flour/\\
/$\frac{1}{2}$ cup sugar/\\
/pinch of salt/

Cut dates into pieces, shake soda over the dates, and pour water over. Add margarine cut into small
pieces and stir well. Break egg into mixture, then add sugar and flour. Divide into two loaf tins
and bake 90 minutes in moderate oven, Regulo 4 (cite:0187).
--8<---------------cut here---------------end--------------->8---

How can I have the ingredients in a left-most column and the method in a
right-most column please? So that everything below the index entries is
in 2-column mode which ends after the citation. And it can then be
renewed below the next index entries of the next entry, ad infinitum.

This is for an org-mode document that is exported to latex and built
into a pdf file.

Thanks
Sharon.
-- 
A taste of linux = http://www.sharons.org.uk
TGmeds = http://www.tgmeds.org.uk
DrugFacts = https://www.drugfacts.org.uk  
Debian 9.3, fluxbox 1.3.7, emacs 25.3.2, org-mode 9.1.6-10-g0c9329-elpaplus

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* Re: 2-column mode for many cooking recipes
  2018-02-28  9:56 2-column mode for many cooking recipes Sharon Kimble
@ 2018-02-28 12:01 ` Eric S Fraga
  2018-02-28 15:16   ` Sharon Kimble
  2018-02-28 16:33   ` Sharon Kimble
  2018-03-01 12:07 ` Sharon Kimble
  1 sibling, 2 replies; 7+ messages in thread
From: Eric S Fraga @ 2018-02-28 12:01 UTC (permalink / raw)
  To: Sharon Kimble; +Cc: org-mode-email


[-- Attachment #1.1: Type: text/plain, Size: 607 bytes --]

On Wednesday, 28 Feb 2018 at 09:56, Sharon Kimble wrote:
> I have this as a recipe -

[...]

> How can I have the ingredients in a left-most column and the method in a
> right-most column please? So that everything below the index entries is
> in 2-column mode which ends after the citation. And it can then be
> renewed below the next index entries of the next entry, ad infinitum.
>
> This is for an org-mode document that is exported to latex and built
> into a pdf file.

You could use special blocks (section 12.10.10 of org manual).  See
attached example for your recipe.  Does require LaTeX magic...

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: recipe.org --]
[-- Type: text/x-org, Size: 1068 bytes --]

#+title: Recipes
#+author: Professor Eric S Fraga
#+macro: lastchange 2018.02.26 11:14
#+options: toc:nil num:nil

* Recipes
#+begin_export latex
\definecolor{verypaleblue}{rgb}{0.95,0.95,1}
\makeatletter\newenvironment{ingredients}{\begin{lrbox}{\@tempboxa}\begin{minipage}{0.3\textwidth}}{\end{minipage}\end{lrbox}\colorbox{verypaleblue}{\usebox{\@tempboxa}}}\makeatother
\makeatletter\newenvironment{steps}{\begin{lrbox}{\@tempboxa}\begin{minipage}{0.6\textwidth}\centering}{\end{minipage}\end{lrbox}\usebox{\@tempboxa}}\makeatother
#+end_export

** Date Bread
#+begin_ingredients
/12 ounces stoned dates/\\
/1 teaspoonful bicarbonate of soda/\\
/1 cupful boiling water/\\
/4 ounces margarine/\\
/1 egg/\\
/2 cups flour/\\
/$\frac{1}{2}$ cup sugar/\\
/pinch of salt/
#+end_ingredients
#+begin_steps
- Cut dates into pieces, shake soda over the dates, and pour water over.
- Add margarine cut into small pieces and stir well.
- Break egg into mixture, then add sugar and flour.
- Divide into two loaf tins and bake 90 minutes in moderate oven, Regulo 4.
#+end_steps

[-- Attachment #1.3: Type: text/plain, Size: 70 bytes --]


-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.6-191-g90607d

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

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

* Re: 2-column mode for many cooking recipes
  2018-02-28 12:01 ` Eric S Fraga
@ 2018-02-28 15:16   ` Sharon Kimble
  2018-02-28 20:11     ` Eric S Fraga
  2018-02-28 16:33   ` Sharon Kimble
  1 sibling, 1 reply; 7+ messages in thread
From: Sharon Kimble @ 2018-02-28 15:16 UTC (permalink / raw)
  To: org-mode-email

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

Eric S Fraga <esflists@gmail.com> writes:

> On Wednesday, 28 Feb 2018 at 09:56, Sharon Kimble wrote:
>> I have this as a recipe -
>
> [...]
>
>> How can I have the ingredients in a left-most column and the method in a
>> right-most column please? So that everything below the index entries is
>> in 2-column mode which ends after the citation. And it can then be
>> renewed below the next index entries of the next entry, ad infinitum.
>>
>> This is for an org-mode document that is exported to latex and built
>> into a pdf file.
>
> You could use special blocks (section 12.10.10 of org manual).  See
> attached example for your recipe.  Does require LaTeX magic...

This is what Eric has suggested -

--8<---------------cut here---------------start------------->8---
* Recipes
#+begin_export latex
\definecolor{verypaleblue}{rgb}{0.95,0.95,1}
\makeatletter\newenvironment{ingredients}{\begin{lrbox}{\@tempboxa}\begin{minipage}{0.3\textwidth}}{\end{minipage}\end{lrbox}\colorbox{verypaleblue}{\usebox{\@tempboxa}}}\makeatother
\makeatletter\newenvironment{steps}{\begin{lrbox}{\@tempboxa}\begin{minipage}{0.6\textwidth}\centering}{\end{minipage}\end{lrbox}\usebox{\@tempboxa}}\makeatother
#+end_export

** Date Bread
#+begin_ingredients
/12 ounces stoned dates/\\
/1 teaspoonful bicarbonate of soda/\\
/1 cupful boiling water/\\
/4 ounces margarine/\\
/1 egg/\\
/2 cups flour/\\
/$\frac{1}{2}$ cup sugar/\\
/pinch of salt/
#+end_ingredients
#+begin_steps
- Cut dates into pieces, shake soda over the dates, and pour water over.
- Add margarine cut into small pieces and stir well.
- Break egg into mixture, then add sugar and flour.
- Divide into two loaf tins and bake 90 minutes in moderate oven, Regulo 4.
#+end_steps
--8<---------------cut here---------------end--------------->8---

And to use these two blocks I've written 2 new snippets -

--8<---------------cut here---------------start------------->8---
# -*- mode: snippet -*-
# name: 2 column, part 1, recipes
# key: xin
# --
#+begin_ingredients
$0
#+end_ingredients
--8<---------------cut here---------------end--------------->8---

and -

--8<---------------cut here---------------start------------->8---
# -*- mode: snippet -*-
# name: 2 column, part 2, recipes
# key: xst
# --
#+begin_steps
$0
#+end_steps
--8<---------------cut here---------------end--------------->8---

And its now all working very well, and greatly enhances the look of the
printed page.

Thanks very much Eric, its working perfectly.

Thanks
Sharon.
-- 
A taste of linux = http://www.sharons.org.uk
TGmeds = http://www.tgmeds.org.uk
DrugFacts = https://www.drugfacts.org.uk  
Debian 9.3, fluxbox 1.3.7, emacs 25.3.2, org-mode 9.1.6-10-g0c9329-elpaplus

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* Re: 2-column mode for many cooking recipes
  2018-02-28 12:01 ` Eric S Fraga
  2018-02-28 15:16   ` Sharon Kimble
@ 2018-02-28 16:33   ` Sharon Kimble
  2018-02-28 20:12     ` Eric S Fraga
  1 sibling, 1 reply; 7+ messages in thread
From: Sharon Kimble @ 2018-02-28 16:33 UTC (permalink / raw)
  To: org-mode-email

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

Eric S Fraga <esflists@gmail.com> writes:

> On Wednesday, 28 Feb 2018 at 09:56, Sharon Kimble wrote:
>> I have this as a recipe -
>
> [...]
>
>> How can I have the ingredients in a left-most column and the method in a
>> right-most column please? So that everything below the index entries is
>> in 2-column mode which ends after the citation. And it can then be
>> renewed below the next index entries of the next entry, ad infinitum.
>>
>> This is for an org-mode document that is exported to latex and built
>> into a pdf file.
>
> You could use special blocks (section 12.10.10 of org manual).  See
> attached example for your recipe.  Does require LaTeX magic...

Unfortunately I spoke too soon.

With this recipe -

--8<---------------cut here---------------start------------->8---
** Macaroon Tart
\index[pies]{Macaroon tart}\index[menu]{Tart!macaroon}\index[cook]{Bake!macaroon tart}
#+begin_ingredients
/\uline{short pastry} [fn:4]/\\
/jam/\\
/1 teacupful sugar/\\
/almond essence/\\
/1 teacupful semolina/\\
/1 reconstituted powdered egg/\\
/3 ounces margarine/
#+end_ingredients
#+begin_steps
- Line the sandwich tin with short pastry.
- Spread jam over it and fill with mixture creamed together from all of the above ingredients.
- Bake in fairly hot oven for over 20 minutes (cite:0186).
#+end_steps

[fn:4] See \uline{Short Pastry+} in Part 1 - Basics, Biscuits, Bread & Pastries
--8<---------------cut here---------------end--------------->8---

Using this code snippet from my init file -

--8<---------------cut here---------------start------------->8---
#+BEGIN_SRC emacs-lisp
(setq org-footnote-section nil)
(setq org-footnote-auto-adjust t)
#+END_SRC
--8<---------------cut here---------------end--------------->8---

All footnotes are shown at the end of the page.

However with Eric's code snippet the footnotes are shown at the end of
'#+end_ingredients', so how can I get it back at the foot of the page
when exported to latex and built into a PDF again please?

Also the footnote has changed from a numerical superscript to an
alphabetical superscript! How could I get them back to numerical ones
please?

Thanks
Sharon.
-- 
A taste of linux = http://www.sharons.org.uk
TGmeds = http://www.tgmeds.org.uk
DrugFacts = https://www.drugfacts.org.uk  
Debian 9.3, fluxbox 1.3.7, emacs 25.3.2, org-mode 9.1.6-10-g0c9329-elpaplus

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* Re: 2-column mode for many cooking recipes
  2018-02-28 15:16   ` Sharon Kimble
@ 2018-02-28 20:11     ` Eric S Fraga
  0 siblings, 0 replies; 7+ messages in thread
From: Eric S Fraga @ 2018-02-28 20:11 UTC (permalink / raw)
  To: Sharon Kimble; +Cc: org-mode-email

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

On Wednesday, 28 Feb 2018 at 15:16, Sharon Kimble wrote:

[...]

> Thanks very much Eric, its working perfectly.

You're welcome.  Glad it worked!  Might be fragile, especially because
of the use of minipages and if you have long recipes, so you might like
to look at using the mdframed package: https://www.ctan.org/pkg/mdframed

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.6-191-g90607d

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

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

* Re: 2-column mode for many cooking recipes
  2018-02-28 16:33   ` Sharon Kimble
@ 2018-02-28 20:12     ` Eric S Fraga
  0 siblings, 0 replies; 7+ messages in thread
From: Eric S Fraga @ 2018-02-28 20:12 UTC (permalink / raw)
  To: Sharon Kimble; +Cc: org-mode-email

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

On Wednesday, 28 Feb 2018 at 16:33, Sharon Kimble wrote:

[...]

> However with Eric's code snippet the footnotes are shown at the end of
> '#+end_ingredients', so how can I get it back at the foot of the page
> when exported to latex and built into a PDF again please?

Untested but see my other reply: it may be that mdframed works better
than minipages.

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.1.6-191-g90607d

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

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

* Re: 2-column mode for many cooking recipes
  2018-02-28  9:56 2-column mode for many cooking recipes Sharon Kimble
  2018-02-28 12:01 ` Eric S Fraga
@ 2018-03-01 12:07 ` Sharon Kimble
  1 sibling, 0 replies; 7+ messages in thread
From: Sharon Kimble @ 2018-03-01 12:07 UTC (permalink / raw)
  To: org-mode-email

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

Sharon Kimble <boudiccas@skimble.plus.com> writes:

> I have this as a recipe -
>
> ** Date Bread
> \index[pies]{Date bread}\index[menu]{Bread!date}\index[cook]{Bake!date bread}\index{Fruit!dates}
> /12 ounces stoned dates/\\
> /1 teaspoonful bicarbonate of soda/\\
> /1 cupful boiling water/\\
> /4 ounces margarine/\\
> /1 egg/\\
> /2 cups flour/\\
> /$\frac{1}{2}$ cup sugar/\\
> /pinch of salt/
>
> Cut dates into pieces, shake soda over the dates, and pour water over. Add margarine cut into small
> pieces and stir well. Break egg into mixture, then add sugar and flour. Divide into two loaf tins
> and bake 90 minutes in moderate oven, Regulo 4 (cite:0187).
>
> How can I have the ingredients in a left-most column and the method in a
> right-most column please? So that everything below the index entries is
> in 2-column mode which ends after the citation. And it can then be
> renewed below the next index entries of the next entry, ad infinitum.
>
> This is for an org-mode document that is exported to latex and built
> into a pdf file.
>
As a follow-up to this, and thanks to Akater and Eric for their input -

--8<---------------cut here---------------start------------->8---
** Macaroon Tart
\index[pies]{Macaroon tart}\index[menu]{Tart!macaroon}\index[cook]{Bake!macaroon tart}
#+begin_ingredients
/\uline{short pastry}/\footnotemark \\
/jam/\\
/1 teacupful sugar/\\
/almond essence/\\
/1 teacupful semolina/\\
/1 reconstituted powdered egg/\\
/3 ounces margarine/
#+end_ingredients
#+begin_steps
- Line the sandwich tin with short pastry.
- Spread jam over it and fill with mixture creamed together from all of the above ingredients.
- Bake in fairly hot oven for over 20 minutes (cite:0186).
#+end_steps

\footnotetext{See \uline{Short Pastry+} in Part 1 - Basics, Biscuits, Bread & Pastries}
\footnotetext{See Short Pastry+ in Part 1 - Basics, Biscuits, Bread \& Pastries}
\footnotetext{See *Short Pastry+* in Part 1 - Basics, Biscuits, Bread \& Pastries}
--8<---------------cut here---------------end--------------->8---

In a minipage like Eric suggested, org-mode footnotes do not work, they
end up putting the footnote at the bottom of their minipage, which isn't
ideal.

The solution is as I've shown above to use \footnotemark and then the
\footnotetext{foo} where you want.

But to get the new footnote to show t the bottom of the page like the
rest of the document you also need to have in your preamble
'#+latex_header: \usepackage[bottom]{footmisc}' which will then place
your new footnote at the bottom of the generated PDF.

But, and its a big but, you can't have any text decorations (think
*bold*, _underline_, etc) in your footnote text as it breaks the
positioning and display of the footnotes. As shown in this latex
output -

--8<---------------cut here---------------start------------->8---
\section{Macaroon Tart}
\label{sec:orgb1ba005}
\index[pies]{Macaroon tart}\index[menu]{Tart!macaroon}\index[cook]{Bake!macaroon tart}
\begin{ingredients}
\emph{\uline{short pastry}}\footnotemark \\
\emph{jam}\\
\emph{1 teacupful sugar}\\
\emph{almond essence}\\
\emph{1 teacupful semolina}\\
\emph{1 reconstituted powdered egg}\\
\emph{3 ounces margarine}
\end{ingredients}
\begin{steps}
\begin{itemize}
\item Line the sandwich tin with short pastry.
\item Spread jam over it and fill with mixture creamed together from all of the above ingredients.
\item Bake in fairly hot oven for over 20 minutes (\cite{0186}).
\end{itemize}
\end{steps}

\footnotetext\{See \uline{Short Pastry+} in Part 1 - Basics, Biscuits, Bread \& Pastries\}
\footnotetext{See Short Pastry+ in Part 1 - Basics, Biscuits, Bread \& Pastries}
\footnotetext{See *Short Pastry+* in Part 1 - Basics, Biscuits, Bread \& Pastries}
--8<---------------cut here---------------end--------------->8---

The first footnote text breaks because of having the underlined text
inside it, it inserts a backslash just before the first opening curly
bracket, and places a backslash just before the closing curly bracket.
Not good!

The second footnote text works.

The third footnote text breaks because of the org-mode decoration,
specifically the stars to either side of 'Short Pastry+'.

Maybe the org-mode exporter to latex could be altered to allow
underlines in footnotes in minipages, but I suspect that it can't be
done. I think that its one of those weird latex-isms, love it or hate
it, you've got to use it to achieve nirvana!

So to summarise -

- if you want footnotes in minipages, you must
- use \footnotemark where you want the footnote inside the minipage, and \footnotetext{foo} outside the minipage,
- use #+latex_header: \usepackage[bottom]{footmisc} to place your built footnote at the page end, and finally 
- do not use any org-mode decoration of text to achieve *bold*, _underline_, etc within your \footnotetext{foo}, use plain text only.

Thanks to Eric and Akater, for their suggestions.
Sharon.
-- 
A taste of linux = http://www.sharons.org.uk
TGmeds = http://www.tgmeds.org.uk
DrugFacts = https://www.drugfacts.org.uk  
Debian 9.3, fluxbox 1.3.7, emacs 25.3.2, org-mode 9.1.6-10-g0c9329-elpaplus

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

end of thread, other threads:[~2018-03-01 12:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-28  9:56 2-column mode for many cooking recipes Sharon Kimble
2018-02-28 12:01 ` Eric S Fraga
2018-02-28 15:16   ` Sharon Kimble
2018-02-28 20:11     ` Eric S Fraga
2018-02-28 16:33   ` Sharon Kimble
2018-02-28 20:12     ` Eric S Fraga
2018-03-01 12:07 ` Sharon Kimble

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