0

I post this same question in stackoverflow (https://stackoverflow.com/questions/61060820/how-to-indent-a-numbered-list-of-references-in-r-markdown) and I was suggested to ask here.

So, my problem is:

I have been trying to indent a numbered list of references in r markdown, but I have not been successful till now.

This is what I want:

 [1]  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

 [2]  bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
      bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
 ...

 [9]  ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
      ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc

[10]  ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
      ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd

And I get it (numbers right-aligned and text indented) in texstudio by using:

\makeatletter
\renewcommand{\@biblabel}[1]{[#1] \hspace{0.2cm}}
\makeatother 

But this is what I get in R markdown pdf output:

[1] aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

[2] bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
   bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
...

[9] ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
   cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc

[10] dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
   dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd

when using:

\setlength{\parindent}{-0.5cm}
\setlength{\leftskip}{0.5cm}
\setlength{\parskip}{8pt}
\noindent

My YAML Header:

documentclass: book
fontsize: 11pt
classoption: twoside
geometry: margin=2.5cm
output:
  bookdown::pdf_document2:
    toc: no
    fig_caption: yes
    keep_tex: yes
    latex_engine: xelatex
    number_sections: yes
    includes: 
      before_body: titlepage.tex
      in_header: preamble.tex
dev: cairo_pdf
always_allow_html: yes
tables: true
bibliography: library.bib
csl: elsevier-vancouver.csl 
urlcolor: black
linkcolor: black
link-citations: yes
2
  • Welcome to TeX.SE. This answer Hanging indents with a Pandoc bibliography suggests adding the hanging package to your Yaml header and then wrapping the production of the references in a hangparas environment. – Ross Jul 6 '20 at 9:31
  • @Ross, thank you for your answer. Unfortunately, it doesn't seem to solve my problem. As it doesn't isolate the numbers from the references (the numbers are treated like text) I cant perfectly indent the text and the result is like the one I posted before. – MDSF Jul 7 '20 at 10:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.