aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README71
-rw-r--r--debian/control2
-rw-r--r--man/man1/markdown2pdf.1.md2
-rw-r--r--src/Text/Pandoc/Writers/LaTeX.hs32
-rw-r--r--src/headers/LaTeXHeader1
-rw-r--r--src/wrappers/markdown2pdf.in6
-rw-r--r--web/myheader.tex3
7 files changed, 59 insertions, 58 deletions
diff --git a/README b/README
index cfdaca1ff..0dcedd70f 100644
--- a/README
+++ b/README
@@ -59,7 +59,7 @@ The wrapper script `markdown2pdf` requires
- the following LaTeX packages (available from [CTAN], if they
are not already included in your LaTeX distribution):
+ `unicode` (for UTF8 characters)
- + `fancyvrb` (for verbatim text in footnotes)
+ + `examplep` (for verbatim text in footnotes and definition lists)
+ `graphicx` (for images)
+ `array` (for tables)
+ `ulem` (for strikeout text)
@@ -85,7 +85,7 @@ Note that you can specify multiple input files on the command line.
`pandoc` will concatenate them all (with blank lines between them)
before parsing:
- pandoc -s chapter1.txt chapter2.txt references.txt > book.html
+ pandoc -s ch1.txt ch2.txt refs.txt > book.html
(The `-s` option here tells `pandoc` to produce a standalone HTML file,
with a proper header, rather than a fragment. For more details on this
@@ -167,7 +167,7 @@ may be used in Windows under Cygwin.)
it will be backed up before being overwritten.) An output file
name can be specified explicitly using the `-o` option:
- markdown2pdf -o "My Book.pdf" chap1.txt chap2.txt chap3.txt
+ markdown2pdf -o book.pdf chap1 chap2
If no input file is specified, input will be taken from STDIN.
All of `pandoc`'s options will work with `markdown2pdf` as well.
@@ -340,7 +340,8 @@ For further documentation, see the `pandoc(1)` man page.
include the names of input files and any special options passed
after ` -- ` on the command line. So, for example,
-: pandoc --dump-args -o foo.html -s foo.txt appendix.txt -- -e latin1
+: pandoc --dump-args -o foo.html -s foo.txt \
+ appendix.txt -- -e latin1
: will cause the following to be printed to STDOUT:
@@ -499,11 +500,13 @@ after the term. The definition consists of one or more block elements
Term *with inline markup*
: Here is the definition. It may
- contain multiple blocks. Here is some code:
+ contain multiple blocks. Here is
+ some code:
: {* my code *}
- : Here is the third paragraph of this definition.
+ : Here is the third paragraph of this
+ definition.
If you leave space after the definition (as in the first example above),
the definitions will be considered paragraphs. In some output formats,
@@ -537,20 +540,19 @@ Pandoc's markdown allows footnotes, using the following syntax:
Here is a footnote reference,[^1] and another.[^longnote]
- [^1]: Here is the footnote. It can go anywhere in the document,
- except in embedded contexts like block quotes or lists.
+ [^1]: Here is the footnote.
- [^longnote]: Here's the other note. This one contains multiple
- blocks.
+ [^longnote]: Here's one with multiple blocks.
- Subsequent paragraphs are indented to show that they belong to
- the previous footnote.
+ Subsequent paragraphs are indented to show
+ that they belong to the previous footnote.
{ some.code }
- The whole paragraph can be indented, or just the first line.
- In this way, multi-paragraph footnotes work just like
- multi-paragraph list items in markdown.
+ The whole paragraph can be indented, or
+ just the first line. In this way,
+ multi-paragraph footnotes work like
+ multi-paragraph list items.
This paragraph won't be part of the note, because it isn't indented.
@@ -616,19 +618,20 @@ try widening it in the markdown source.
Multiline tables allow headers and table rows to span multiple lines
of text. Here is an example:
- ---------------------------------------------------------------
- Centered Left Right
- Header Aligned Aligned Default aligned
- ---------- --------- ----------- ---------------------------
- First row 12.0 Example of a row that spans
- multiple lines.
-
- Second row 5.0 Here's another one. Note
- the blank line between rows.
- ---------------------------------------------------------------
-
- Table: Optional caption. This, too, may span multiple
- lines.
+ ----------------------------------------
+ Centered Left-aligned Right-aligned
+ Header Header Header
+ ---------- ------------- --------------
+ First This is a 12.0
+ two-line row.
+
+ Second This row is 5.0
+ three lines
+ long.
+ ----------------------------------------
+
+ Table: Optional caption. This, too,
+ may span multiple lines.
These work like simple tables, but with the following differences:
@@ -734,13 +737,11 @@ derive the identifier from the header text,
- Replace all spaces, dashes, newlines, and hyphens with hyphens.
- Convert all alphabetic characters to lowercase.
-Thus,
-
- Header text Identifier
- --------------------------------- --- --------------------------------
- Header identifiers in HTML → `header-identifiers-in-html`
- *Dogs*?--in *my* house? → `dogs--in-my-house`
- [HTML], [S5], or [RTF]? → `html-s5-or-rtf`
+Thus, for example, a heading 'Header identifiers in HTML' will get
+the identifier `header-identifiers-in-html`, a heading
+'*Dogs*?--in *my* house?' will get the identifier `dogs--in-my-house`,
+and a heading '[HTML], [S5], or [RTF]?' will get the identifier
+`html-s5-or-rtf`.
These rules should, in most cases, allow one to determine the identifier
from the header text. The exception is when several headers have the
diff --git a/debian/control b/debian/control
index c2f908292..58c20b8c3 100644
--- a/debian/control
+++ b/debian/control
@@ -10,7 +10,7 @@ Package: pandoc
Section: text
Architecture: any
Depends: ${shlibs:Depends}
-Suggests: texlive-latex-recommended | tetex-extra, tidy, wget | w3m
+Suggests: texlive-latex-recommended | tetex-extra, texlive-latex-extra, tidy, wget | w3m
Description: general markup converter
Pandoc is a Haskell library for converting from one markup format to
another, and a command-line tool that uses this library. It can read
diff --git a/man/man1/markdown2pdf.1.md b/man/man1/markdown2pdf.1.md
index ecaabc35e..13f94ee1d 100644
--- a/man/man1/markdown2pdf.1.md
+++ b/man/man1/markdown2pdf.1.md
@@ -28,7 +28,7 @@ output through `iconv`:
iconv -t utf-8 input.txt | pandoc | iconv -f utf-8
-`markdown2pdf` assumes that the `unicode`, `fancyvrb`, `array`,
+`markdown2pdf` assumes that the `unicode`, `examplep`, `array`,
`graphicx`, and `ulem` packages are in latex's search path. If these
packages are not included in your latex setup, they can be obtained from
<http://ctan.org>.
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
index cc2da8338..c9c923dae 100644
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -34,6 +34,7 @@ import Text.Pandoc.Definition
import Text.Pandoc.Shared
import Text.Printf ( printf )
import Data.List ( (\\), isInfixOf )
+import Data.Char ( isAlphaNum )
import qualified Data.Set as S
import Control.Monad.State
@@ -81,15 +82,12 @@ latexHeader options (Meta title authors date) = do
then ""
else "\\date{" ++ stringToLaTeX date ++ "}\n"
let maketitle = if null title then "" else "\\maketitle\n"
- let verbatim = if "\\usepackage{fancyvrb}" `isInfixOf` extras
- then "\\VerbatimFootnotes % allows verbatim text in footnotes\n"
- else ""
let secnumline = if (writerNumberSections options)
then ""
else "\\setcounter{secnumdepth}{0}\n"
let baseHeader = writerHeader options
let header = baseHeader ++ extras
- return $ header ++ secnumline ++ verbatim ++ titletext ++ authorstext ++
+ return $ header ++ secnumline ++ titletext ++ authorstext ++
datetext ++ "\\begin{document}\n" ++ maketitle ++ "\n"
-- escape things as needed for LaTeX
@@ -106,11 +104,11 @@ stringToLaTeX = escapeStringUsing latexEscapes
]
-- | Remove all code elements from list of inline elements
--- (because it's illegal to have a \\verb inside a command argument)
+-- (because it's illegal to have verbatim inside some command arguments)
deVerb :: [Inline] -> [Inline]
deVerb [] = []
deVerb ((Code str):rest) =
- (Str $ stringToLaTeX str):(deVerb rest)
+ (TeX $ "\\texttt{" ++ stringToLaTeX str ++ "}"):(deVerb rest)
deVerb (other:rest) = other:(deVerb rest)
-- | Convert Pandoc block element to LaTeX.
@@ -155,7 +153,7 @@ blockToLaTeX (Table caption aligns widths heads rows) = do
AlignCenter -> "\\centering"
AlignDefault -> "\\raggedright") ++
"\\hspace{0pt}}p{" ++ width ++
- "\\textwidth}")
+ "\\columnwidth}")
colWidths aligns
let tableBody = "\\begin{tabular}{" ++ colDescriptors ++ "}\n" ++
headers ++ "\\hline\n" ++ concat rows' ++ "\\end{tabular}\n"
@@ -177,7 +175,7 @@ tableRowToLaTeX cols =
listItemToLaTeX lst = blockListToLaTeX lst >>= (return . ("\\item "++))
defListItemToLaTeX (term, def) = do
- term' <- inlineListToLaTeX (deVerb term)
+ term' <- inlineListToLaTeX term
def' <- blockListToLaTeX def
return $ "\\item[" ++ term' ++ "] " ++ def'
@@ -196,27 +194,28 @@ isQuoted _ = False
inlineToLaTeX :: Inline -- ^ Inline to convert
-> State WriterState String
inlineToLaTeX (Emph lst) = do
- contents <- inlineListToLaTeX (deVerb lst)
+ contents <- inlineListToLaTeX lst
return $ "\\emph{" ++ contents ++ "}"
inlineToLaTeX (Strong lst) = do
- contents <- inlineListToLaTeX (deVerb lst)
+ contents <- inlineListToLaTeX lst
return $ "\\textbf{" ++ contents ++ "}"
inlineToLaTeX (Strikeout lst) = do
- contents <- inlineListToLaTeX (deVerb lst)
+ contents <- inlineListToLaTeX lst
addToHeader "\\usepackage[normalem]{ulem}"
return $ "\\sout{" ++ contents ++ "}"
inlineToLaTeX (Superscript lst) = do
- contents <- inlineListToLaTeX (deVerb lst)
+ contents <- inlineListToLaTeX lst
return $ "\\textsuperscript{" ++ contents ++ "}"
inlineToLaTeX (Subscript lst) = do
- contents <- inlineListToLaTeX (deVerb lst)
+ contents <- inlineListToLaTeX lst
-- oddly, latex includes \textsuperscript but not \textsubscript
-- so we have to define it:
addToHeader "\\newcommand{\\textsubscript}[1]{\\ensuremath{_{\\scriptsize\\textrm{#1}}}}"
return $ "\\textsubscript{" ++ contents ++ "}"
-inlineToLaTeX (Code str) = return $ "\\verb" ++ [chr] ++ stuffing ++ [chr]
- where stuffing = str
- chr = (('`':(enumFromTo '!' '~')) \\ stuffing) !! 0
+inlineToLaTeX (Code str) = return $ "\\Q{" ++ stuffing ++ "}"
+ where stuffing = concatMap (\c -> if isAlphaNum c
+ then [c]
+ else ['\\',c]) str
inlineToLaTeX (Quoted SingleQuote lst) = do
contents <- inlineListToLaTeX lst
let s1 = if (not (null lst)) && (isQuoted (head lst)) then "\\," else ""
@@ -244,7 +243,6 @@ inlineToLaTeX (Image alternate (source, tit)) = do
addToHeader "\\usepackage{graphicx}"
return $ "\\includegraphics{" ++ source ++ "}"
inlineToLaTeX (Note contents) = do
- addToHeader "\\usepackage{fancyvrb}"
contents' <- blockListToLaTeX contents
return $ "\\footnote{" ++ stripTrailingNewlines contents' ++ "}"
diff --git a/src/headers/LaTeXHeader b/src/headers/LaTeXHeader
index 095848adf..125ab258e 100644
--- a/src/headers/LaTeXHeader
+++ b/src/headers/LaTeXHeader
@@ -1,5 +1,6 @@
\documentclass{article}
\usepackage{ucs}
\usepackage[utf8x]{inputenc}
+\usepackage[Q=yes,verbatimenv=yes,pverb-linebreak=no]{examplep}
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}
diff --git a/src/wrappers/markdown2pdf.in b/src/wrappers/markdown2pdf.in
index c9a01fa16..7347fd7d7 100644
--- a/src/wrappers/markdown2pdf.in
+++ b/src/wrappers/markdown2pdf.in
@@ -40,9 +40,9 @@ fi
err "${THIS}: Please install the 'unicode' package from CTAN:"
err " http://www.ctan.org/tex-archive/macros/latex/contrib/unicode/"
fi
- if grep -q "File \`fancyvrb.sty' not found" $texname.log; then
- err "${THIS}: Please install the 'fancyvrb' package from CTAN:"
- err " http://www.ctan.org/tex-archive/macros/latex/contrib/fancyvrb/"
+ if grep -q "File \`examplep.sty' not found" $texname.log; then
+ err "${THIS}: Please install the 'examplep' package from CTAN:"
+ err " http://www.ctan.org/tex-archive/macros/latex/contrib/examplep/"
fi
if grep -q "File \`ulem.sty' not found" $texname.log; then
err "${THIS}: Please install the 'ulem' package from CTAN:"
diff --git a/web/myheader.tex b/web/myheader.tex
index ee0123097..817bff14a 100644
--- a/web/myheader.tex
+++ b/web/myheader.tex
@@ -1,4 +1,5 @@
-\documentclass[12pt]{article}
+\documentclass[twocolumn,11pt]{article}
\usepackage{txfonts}
+\usepackage[margin=2cm]{geometry}
\usepackage{ucs}
\usepackage[utf8x]{inputenc}