Document ClassesPublishing a Book of Quotations

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
ushbayev
Posts: 9
Joined: Tue Apr 13, 2010 6:43 pm

Publishing a Book of Quotations

Post by ushbayev »

Dear friends,

I would really appreciate if someone could enlighten me here. I have for over a decade been compiling a book of quotes. Although I am a relatively experienced user of Latex, i have carried my book in MS Word format all these years. I am now thinking of organizing it more accurately, and potentially converting to LaTeX.

my question: does there exist / is it possible to create any document class or some scheme, where I would have a database of quotes (much like a bibliography database) and then have it (or a selection of if) presented and laid out in a document by LaTeX (much like BibTeX creates the display of bibliography from the database).

another question: are there any other suggestions as how I should/could go about solving my task of organizing the book in latex? i'd like the quotes to have special tags for topics, and to be able to sort them by authors or topics using latex.


Thanks,
Anuar

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

koleygr
Posts: 21
Joined: Fri Jul 01, 2011 11:18 pm

Publishing a Book of Quotations

Post by koleygr »

Hi ushbayev,
I can't understand what excactly you are asking, but i am sure
that you can use XeLaTeX for your book. (It had some problems
-at least with greek- but i have manage to make books in XeLaTeX)
I don't use Bibliography for my work but i have create a simple
book that uses Bibliography and it works fine.
(If you want i can post the code of it)

Also, JabRef is a program that you can use for Bibliography
and i can't understand what exactly means quotes but you can check
it here:
http://jabref.sourceforge.net/

If you want something more specific... you can
make a simple application using Qt Creator. You need to
know some c++... but if you don't, by "googling" is easy
to find enought stuff for such a simple project.
The site is here:
http://www.qtsoftware.com/developer/qt-creator

If you deside use Qt Creator just message me to help you.

Kostis
Using Kile 2.1.0 under Ubuntu software.
\XeLaTeX: XeTeX 3.1415926-2.2-0.9995.2 (TeX Live 2009/Debian)
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Publishing a Book of Quotations

Post by cgnieder »

ushbayev wrote:does there exist / is it possible to create any document class or some scheme, where I would have a database of quotes (much like a bibliography database) and then have it (or a selection of if) presented and laid out in a document by LaTeX (much like BibTeX creates the display of bibliography from the database).
This is surely possible. Since it is possibly to save (nearly) anything in a macro I would try something along the following lines:

Create a file quotes-database.tex which provides the commands \savequotation and \usequotation as well as contains the quotes themselves. This file can then be \input into the main file where the quotes then can be used.

Below I have a small example that uses pgfkeys to provide a comfortable key/value syntax for the \savequotation command, uses etoolbox for \csdef and \ifblank and uses csquotes for the \blockquote command. Since you say you are an experienced LaTeX user I think you'll be able to adapt the example for your needs :)

For the sake of providing a complete example the file quotes-database.tex is included in the following example through the {filecontents} environment:

Code: Select all

\documentclass{scrartcl}

\usepackage{filecontents}
\begin{filecontents}{quotes-database.tex}
\RequirePackage{pgfkeys,etoolbox,csquotes}

% \savequotation{<id>}{
%  name  = {<author>} ,
%  quote = {quote}
% }
\newcommand\savequotation[2]{%
  \pgfkeys{
    quotes/.cd ,
      name/.code  = \csdef{#1@quotation@author}{##1} ,
      quote/.code = \long\csdef{#1@quotation@quote}{##1}
  }%
  \pgfqkeys{/quotes}{#2}%
}

% \usequotation{<id>}
\newcommand\usequotation[2][]{%
  \ifblank{#1}
    {\blockquote[\csuse{#2@quotation@author}]{\csuse{#2@quotation@quote}}}
    {\blockquote[\csuse{#2@quotation@author}~#1]{\csuse{#2@quotation@quote}}}%
}

\savequotation{Einstein}
  {
    name  = Albert Einstein ,
    quote = {Insanity: doing the same thing over and over again and expecting
      different results.}
  }
\savequotation{Twain}
  {
    name  = Mark Twain ,
    quote = {Suppose you were an idiot, and suppose you were a member of
      Congress; but I repeat myself.}
  }
\savequotation{Jefferson}
  {
    name  = Thomas Jefferson ,
    quote = {A wise and frugal Government, which shall restrain men from injuring
      one another, which shall leave them otherwise free to regulate their own
      pursuits of industry and improvement, and shall not take from the mouth of
      labor the bread it has earned. This is the sum of good government, and this
      is necessary to close the circlue of our felicities.}
  }
\endinput
\end{filecontents}

\input{quotes-database.tex}

\begin{document}

A first try: \usequotation{Einstein}. And a second one: \usequotation{Twain}.
A more longish quote: \usequotation{Jefferson}

\end{document}
Regards
site moderator & package author
ushbayev
Posts: 9
Joined: Tue Apr 13, 2010 6:43 pm

Re: Publishing a Book of Quotations

Post by ushbayev »

koleygr, cgnieder

Thank you both, I can now solve my problems I think.
Post Reply