Skip to content

Commit

Permalink
an example of using Springer's svmono class
Browse files Browse the repository at this point in the history
you have to put at least svmono.cls and spbasic.bst under the root directory
  • Loading branch information
yihui committed Jul 28, 2016
1 parent 5cce378 commit 23ba576
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions _output.yml
Expand Up @@ -13,4 +13,6 @@ bookdown::pdf_book:
in_header: preamble.tex
latex_engine: xelatex
citation_package: natbib
template: null
pandoc_args: --chapters

This comment has been minimized.

Copy link
@gvwilson

gvwilson Nov 3, 2019

2019-11-03: this is now pandoc_args: --top-level-division=chapter

This comment has been minimized.

Copy link
@yihui

yihui Nov 18, 2019

Author Member

Thanks!

bookdown::epub_book: default
5 changes: 3 additions & 2 deletions index.Rmd
Expand Up @@ -4,9 +4,10 @@ author: "Yihui Xie"
date: "`r Sys.Date()`"
site: bookdown::bookdown_site
output: bookdown::gitbook
documentclass: book
documentclass: svmono
classoption: graybox,envcountchap,sectrefs
bibliography: [book.bib, packages.bib]
biblio-style: apalike
biblio-style: spbasic
link-citations: yes
github-repo: rstudio/bookdown-demo
description: "This is a minimal example of using the bookdown package to write a book. The output format for this example is bookdown::gitbook."
Expand Down

10 comments on commit 23ba576

@augustoamerico
Copy link

@augustoamerico augustoamerico commented on 23ba576 Sep 7, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


Platform: Windows 10 Pro
Pandoc Version: 1.17.2
MikTeX Version: 2.9


I can't run this example successfuly. I've downloaded the svmono.cls and spbasic.bst under the root directory but still I'm having problems.
When running

"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS bookdown-demo-changed.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output bookdown-demo-changed.pdf --template "C:\Users\Altran\Documents\R\win-library\3.3\rmarkdown\rmd\latex\default-1.17.0.2.tex" --highlight-style tango --latex-engine pdflatex --variable graphics=yes --variable "geometry:margin=1in" --bibliography book.bib --bibliography packages.bib --filter pandoc-citeproc 

I get the following error:

! LaTeX Error: Command \subtitle already defined.
               Or name \end... illegal, see p.192 of the manual.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.116 }

pandoc.exe: Error producing PDF
Error: pandoc document conversion failed with error 43
In addition: Warning message:
running command '"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS bookdown-demo-changed.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output bookdown-demo-changed.pdf --template "C:\Users\Altran\Documents\R\win-library\3.3\rmarkdown\rmd\latex\default-1.17.0.2.tex" --highlight-style tango --latex-engine pdflatex --variable graphics=yes --variable "geometry:margin=1in" --bibliography book.bib --bibliography packages.bib --filter pandoc-citeproc' had status 43 

In order to understand the error a little bit better, I've deleted the following lines from the default-1.17.0.2.tex:

\newcommand{\subtitle}[1]{
  \posttitle{
    \begin{center}\large#1\end{center}
    }
}

And I don't have an error anymore. But the output is not like the one that you shared

What am I doing wrong?

@yihui
Copy link
Member Author

@yihui yihui commented on 23ba576 Sep 7, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you also make the changes in _output.yml like what I did above? template: null is important

@augustoamerico
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes.

Another thing that I forget to tell is that I am not running with the "Build -> Build All", I am trying to do this by run

rmarkdown::render_site(input = ".", output_format = "pdf_document")

@yihui
Copy link
Member Author

@yihui yihui commented on 23ba576 Sep 7, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is supposed to work with bookdown::pdf_book, or the Build Book button. I'm not really sure if rmarkdown::render_site or pdf_document works.

@augustoamerico
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted @yihui ! Thank you very much for the feedback!

@dusadrian
Copy link

@dusadrian dusadrian commented on 23ba576 Mar 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi again,

This used to work for me, but something got updated (have recently installed Hugo, along with an update of many other R packages, perhaps it tinkered with some other files)... and it doesn't work anymore.

With a fresh default bookdown_demo directory where I added svmono.cls, svind.ist and spbasic.bst files, when building from RStudio I get this error:

output file: bookdown-demo.knit.md

! LaTeX Error: Command \proof already defined.
               Or name \end... illegal, see p.192 of the manual.

Error: Failed to compile bookdown-demo.tex. See bookdown-demo.log for more info.
Execution halted

Exited with status 1.

I also tried from the command line, with:
bookdown::render_book("index.Rmd", bookdown::pdf_book(keep_tex = TRUE))

and here I get a different, but similar error:

! LaTeX Error: Command \subtitle already defined.
               Or name \end... illegal, see p.192 of the manual.

Error: Failed to compile bookdown-demo.tex. See bookdown-demo.log for more info.

And this is the same error which is mentioned in the bookdown-demo.log file. I'd be grateful for any additional hint, thanks very much in advance.

@PirateGrunt
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also get a LaTeX error:

Latexmk, John Collins, 1 January 2015. Version 4.41
! LaTeX Error: Command \subtitle already defined.
               Or name \end... illegal, see p.192 of the manual.

@yihui
Copy link
Member Author

@yihui yihui commented on 23ba576 Jan 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the solution is to define a custom Pandoc LaTeX template (and don't define the \subtitle command): https://bookdown.org/yihui/bookdown/templates.html but I don't have time for it.

@boyasaanuo
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello Yihui, thank you for the above guidance.

I tried following the book guide to compile my thesis with my university's LaTeX template, but I get the error

! LaTeX Error: Missing \begin{document}.

This is what I have in my Index YAML


title: "The Asian Tigers miracle; the role of Public Expenditure: Lessons for Africa"
subtitle:

  • "By"
  • "Blaise Boya Kuubetertii Saanuo"
  • "(BSc. Economics & Business Administration, Management)"
    author:
  • "A thesis submitted to the Department of Accounting and Finance, Kwame Nkrumah University of Science and Technology, Kumasi in partial fulfilment of the requirements for the award degree of"
  • "MASTER OF PHILOSOPHY IN BUSINESS ADMINISTRATION"
  • "[FINANCE]"
    date: "June, 2020"
    output:
    bookdown::gitbook:
    css: style.css
    split_by: chapter
    config:
    toc:
    collapse: section
    before: |
  • My MPhil Thesis Report

  • Blaise Boya Kuubetertii Saanuo

  • after: |
  • Proudly published with bookdown

  • toolbar:
    position: fixed
    search: yes
    download: no
    edit: no
    fontsettings:
    theme: white
    family: sans
    size: 2
    sharing:
    facebook: yes
    twitter: yes
    github: yes
    all: false
    bookdown::pdf_book:
    includes:
    in_header: preamble.tex
    template: null
    keep_tex: yes
    latex_engine: xelatex
    citation_package: none
    pandoc_args: --top-level-division=chapter
    mainfont: "Times New Roman"
    fontsize: 12pt
    papersize: a4
    linestretch: 1.5
    toc: true
    toc-depth: 3
    lof: True
    lot: True
    site: bookdown::bookdown_site
    documentclass: book
    classoption: knustthesis.tex
    bibliography: ["book.bib", "packages.bib"]
    csl: harvard-educational-review.csl
    link-citations: yes
    geometry: "left=4cm, right=2.5cm, top=2.5cm, bottom=2.5cm"

The connect of my University Template is below

\documentclass[a4paper,12pt, oneside]{book}
\usepackage{knustthesis}

\begin{document}

\include{titlepage}

\frontmatter
%\pagenumbering{roman}
\include{A1-declaration}
\include{A2-dedication}
\include{A3-acknowledgement}
\include{A4-abstract}

\addcontentsline{toc}{chapter}{Declaration}
\addcontentsline{toc}{chapter}{Dedication}
\addcontentsline{toc}{chapter}{Acknowledgement}
\addcontentsline{toc}{chapter}{Abstract}

\tableofcontents

\newpage
\listoftables
\addcontentsline{toc}{chapter}{List of Tables}

\newpage
\listoffigures
\addcontentsline{toc}{chapter}{List of Figures}

\mainmatter
\include{01-intro}
\include{02-literature}
\include{03-method}
\include{04-application}
\include{05-summary}

%\include{ref}

\backmatter

\bibliographystyle{harvard-educational-review}
\bibliography{reference}
\addcontentsline{toc}{chapter}{References}

\include{07-appendices}

\end{document}

I did a bit of editing to suit my work

and the content of the .sty file is below

\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[left=4.00cm, right=2.50cm, top=2.50cm, bottom=2.50cm]{geometry}
\newtheorem{definition}{Definition}
\newtheorem{example}{Example}[section]
\newtheorem{theorem}{Theorem}[section]
\usepackage{enumerate}
\usepackage{tabularx}
\usepackage{placeins}
\setlength{\parindent}{1.5cm}
\pagestyle{plain}
\usepackage{tocloft}

\usepackage{setspace, latexsym}
\doublespacing
\usepackage[round]{natbib}
%\bibpunct{(}{)}{;}{a}{,}{,}

\renewcommand{\chaptername}{CHAPTER}{\Large}
\usepackage{titlesec}

\titleformat{\chapter}[display]
{\normalfont\Large\bfseries\centering\Numberstring{section}}{\chaptertitlename\ \thechapter}{20pt}{\Large}

\titlespacing*{\chapter}{0pt}{0pt}{0em}
\renewcommand{\baselinestretch}{1}
\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}}

\renewcommand{\bibname}{REFERENCES}

what can I do to be able to compile my thesis using bookdown with my University LaTeX template

@yihui
Copy link
Member Author

@yihui yihui commented on 23ba576 Dec 10, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why people keep asking LaTeX questions on this irrelevant commit on Github. This is not the right place for asking questions, and I'll ignore future questions here. Please read the guide https://yihui.org/issue/ and ask questions in other appropriate places. Thanks!

@boyasaanuo Please try remotes::install_github('rstudio/rmarkdown').

Please sign in to comment.