emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] How to generate an index?


From: Sharon Kimble
Subject: Re: [O] How to generate an index?
Date: Wed, 07 May 2014 15:31:53 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

John Hendy <address@hidden> writes:

> On Tue, May 6, 2014 at 1:32 PM, Sharon Kimble
> <address@hidden> wrote:
>>
>> Now I've got the bibliography working I'm looking at getting indexes
>> to be generated.
>>
>> Using my long-suffering "cat.org" with this code in my ".emacs"
>> --8<---------------cut here---------------start------------->8---
>> ;; org to latex customisations, -shell-escape needed for minted
>> (setq org-export-dispatch-use-expert-ui t ; non-intrusive export dispatch
>>       org-latex-pdf-process             ; for regular export
>>       '("xelatex -shell-escape -interaction nonstopmode -output-directory %o 
>> %f"
>>                 "biber %b"
>>         "xelatex -shell-escape -interaction nonstopmode -output-directory %o 
>> %f"
>>         "xelatex -shell-escape -interaction nonstopmode -output-directory %o 
>> %f"))
>> --8<---------------cut here---------------end--------------->8---
>>
>> and this is my "cat.org"
>> --8<---------------cut here---------------start------------->8---
>> # -*- mode:org; mode:reftex; indent-tabs-mode:nil; tab-width:2 -*-
>> #+OPTIONS: toc:nil num:nil
>> #+OPTIONS: ^:{}
>> #+TITLE: Cat on the mat - 2014
>> #+AUTHOR: Sharon Kimble.
>> #+LATEX_CMD: xelatex
>> #+LATEX_CLASS: article
>> #+LATEX_CLASS_OPTIONS: [a4paper]
>> #+LaTeX_HEADER: \usepackage{makeidx} %robustindex % Indexing
>> #+LaTeX_HEADER: 
>> \usepackage[backend=biber,style=verbose,style=numeric]{biblatex}
>> #+LaTeX_HEADER: \bibliography{cat}
>> #+LATEX_HEADER: \usepackage[colorlinks=true]{hyperref}
>> \makeindex
>> \pagebreak
>> \makeindex
>> \begin{document}
>> * Chapter 1
>> Lorem ipsum dolor sit amet, consectetuer \cite{5} adipiscing elit, sed diam 
>> nonummy
>> nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi
>> enim ad minim veniam \cite{15}.
>>
>> * Chapter 2
>> Lorem ipsum dolor sit amet, consectetuer \cite{7} adipiscing elit, sed diam
>> nonummy nibh euismod tincidunt ut laoreet dolore magna\index{magna} aliquam
>> erat volutpat. Ut wisi enim ad minim veniam,\cite{1} quis nostrud exerci
>> tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo
>> consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit
>> esse molestie consequat\cite{12}.
>>
>> \printbibliography
>>
>> \printindex
>>
>> \end{document}
>> --8<---------------cut here---------------end--------------->8---
>>
>> And I run "C-c C-e l p" to generate the "cat.tex" and the "cat.pdf",
>> but no "cat.idx" or "cat.aux" is generated. I've tried running "C-c
>> C-e l l" three times then generating the "cat.pdf" but I can't get
>> one generated.
>>
>> I've googled and looked in the "Org Manual" but haven't found how
>> to do it. Can anyone help please?
>
> Org is great, but I steer away from looking for Org documentation when
> LaTeX isn't working. Like others have mentioned, figure out the LaTeX
> first, then figure out how to make Org do your LaTeX bidding.
>
> Did you read through/follow some start-to-finish instructions on how
> to generate indexes with LaTeX? I've never done it, but just googling
> "generate index latex" gets me this:
> - http://en.wikibooks.org/wiki/LaTeX/Indexing

Thanks, I also used this - http://www.sharelatex.com/learn/Main_Page
>
> Looks like you have most of what it suggests:
> 1) \usepackage{makeidx}
> 2) \makeindex in preamble (though I'm not sure why you have it twice)
> 3) \printindex to show the index
>
> What I don't see of it's suggestions are:
> 1) Use \index{key} to tell it /what/ to index. What are you hoping
> shows up in your index? Looks like LaTeX has no idea what words to
> spit out unless you tell it!
> 2) Looks like you still might have to run `makeindex cat` after
> compiling with LaTeX?
>
> Re. that last bit, can you try replacing your opening bit with:
>
> * Chapter 1
> \index{Lorem} ipsum dolor...
>
> Then:
> - Run C-c C-e l p (hopefully that spits out a .idx file since there's
> at least one word you want to index)
> - Run `makeindex cat`, which will process the hopefully-output file,
> cat.idx from the previous step
> - Re-run C-c C-e l p from Org
>
> If that doesn't work, I'd still try LaTeX manually before posting back. So:
> - pdflatex cat
> - biber cat
> - makeindex cat
> - pdflatex cat
>
> Or something like that for your full bib/index workflow. Then, if
> successful, someone can tell you how to get Org to call the right
> LaTeX stuff.

I've been able to get indexing references and a glossary all
working, but the results are not pretty!
--8<---------------cut here---------------start------------->8---
;;; to go into ".emacs"
;; ;; org to latex customisations, -shell-escape needed for minted
(setq org-export-dispatch-use-expert-ui t ; non-intrusive export dispatch
      org-latex-pdf-process             ; for regular export
      '("xelatex -shell-escape -interaction nonstopmode -output-directory %o %f"
                "biber %b"
                "xelatex -shell-escape -interaction nonstopmode 
-output-directory %o %f"
                "makeindex %b"
                "xelatex -shell-escape -interaction nonstopmode 
-output-directory %o %f"
                "makeglossaries %b"
                "makeglossaries %b"
        "xelatex -shell-escape -interaction nonstopmode -output-directory %o 
%f"))
--8<---------------cut here---------------end--------------->8---

--8<---------------cut here---------------start------------->8---
;;; the org-mode file to be converted into "foo.tex" and "foo.pdf"
# -*- mode:org; mode:reftex; indent-tabs-mode:nil; tab-width:2 -*-
#+OPTIONS: toc:t num:t
#+OPTIONS: ^:{}
#+LATEX_CMD: xetex
#+TITLE: Cat on the mat - 2014
#+AUTHOR: Sharon Kimble.
#+LATEX_CLASS: article
#+LATEX_CLASS_OPTIONS: [a4paper]
#+LaTeX_HEADER: \usepackage[utf8]{inputenc}
#+LaTeX_HEADER: \usepackage{imakeidx}
#+LaTeX_HEADER: \makeindex[title=Index,intoc]
#+LaTeX_HEADER: 
\usepackage[backend=biber,style=verbose,style=numeric,intoc]{biblatex}
#+LaTeX_HEADER: \bibliography{cat}
#+LaTeX_HEADER: \usepackage[toc]{glossaries}
#+LaTeX_HEADER: \makeglossaries
#+LaTeX_HEADER: \input{INP-00-glossary}
\begin{document}
 
\maketitle

* Chapter 1
Lorem ipsum dolor sit \gls{maths} amet, consectetuer \cite{5} adipiscing elit, 
sed diam nonummy
nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi
enim ad minim veniam, quis nostrud\gls{computer}} exerci tation ullamcorper 
suscipit lobortis
nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in
hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu
feugiat nulla facilisis \cite{6} at vero eros et accumsan et iusto odio 
dignissim qui
blandit praesent luptatum zzril delenit augue \cite{3} duis dolore te feugait 
nulla
facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil
imperdiet doming id quod mazim placerat facer possim assum. Typi non habent
claritatem insitam; est usus legentis in iis qui \cite{14} facit eorum
claritatem. Investigationes demonstraverunt lectores legere me lius quod ii
legunt saepius \cite{1}. Claritas est etiam processus
dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare
quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum
formas humanitatis per seacula quarta decima et quinta decima \cite{13}. Eodem 
modo
typi, qui nunc nobis \cite{4} videntur parum clari, fiant sollemnes in futurum.

* Chapter 2
Lorem \index{Lorem} ipsum dolor sit amet, consectetuer \cite{7} adipiscing 
elit, sed diam
nonummy nibh euismod tincidunt ut laoreet dolore magna\index{magna} aliquam
erat volutpat. Ut wisi enim ad minim veniam,\cite{1} quis nostrud exerci
tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo
consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit
esse molestie consequat\cite{12}, vel illum dolore eu feugiat nulla facilisis
at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum
zzril delenit augue duis dolore te \index{te} feugait nulla facilisi. Nam liber 
tempor
cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim
placerat facer possim assum \cite{2}. Typi non habent claritatem insitam;
\cite{10} est usus legentis in iis qui facit eorum claritatem. Investigationes
demonstraverunt lectores legere me lius quod \cite{11} ii legunt
saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem
consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc
putamus parum claram\index{claram}, anteposuerit litterarum formas humanitatis
per seacula quarta decima et quinta decima \cite{3}. Eodem modo typi, qui nunc
nobis videntur parum clari, \cite{9} fiant sollemnes in futurum \cite{8}.

\printglossaries

\printbibliography

\printindex

\end{document}
--8<---------------cut here---------------end--------------->8---

--8<---------------cut here---------------start------------->8---
;;; "INP-00-glossary" - an external glossary file to keep its contents clean
\newglossaryentry{maths}{name=maths,description={Mathematics is what 
mathematicians do}}
\newglossaryentry{computer}{name=computer,description={is a programmable
machine that receives input, stores and manipulates data, and provides output 
in a useful format}}
--8<---------------cut here---------------end--------------->8---

--8<---------------cut here---------------start------------->8---
;;; "cat.bib" only part so you can see what it looks like
@Article{1,
  author = {MacRae K. Pattison J.},
  title = {Home chemotherapy.},
  journaltitle = {Nursing Times},
  year = {2002},
  key = {1},
  volume = {98},
  number = {35},
  pages = {34-35},
}
@Book{2,
  title = {Bailliere's Nurses Dictionary},
  year = {2004},
  key = {2},
  editor = {Weller B.F.},
  edition = {23rd edition},
  publisher = {Bailliere Tindall and Royal College of Nursing},
}
@Book{3,
  title = {Martindale Extra Pharmacopoeia},
  year = {1996},
  key = {3},  
  editor = {James E. F. Reynolds},
  edition = {31st},
  publisher = {Royal Pharmaceutical Society},
  location = {London},
}
--8<---------------cut here---------------end--------------->8---

These four files gives the output of "cat.pdf", attached.

* Things not working properly
- I can't find how to get the title, author and date on a page of
their own. 
- I can't find how to get "references" showing in the table of
contents.
- The index is working with the default of 2 columns, but I want the
page numbers to all be aligned to the right. I haven't yet found how
to do it.

Can anyone help with any, or all, of the three problems I've just
outlined please? Apart from those its working well :)

Sharon.

Attachment: cat.pdf
Description: Adobe PDF document

-- 
A taste of linux = http://www.sharons.org.uk
my git repo = https://bitbucket.org/boudiccas/dots
TGmeds = http://www.tgmeds.org.uk
Debian testing, Fluxbox 1.3.5, emacs 24.4.50.19

Attachment: signature.asc
Description: PGP signature


reply via email to

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