Rapporter / pander

An R Pandoc Writer: Convert arbitrary R objects into markdown
http://rapporter.github.io/pander/
Open Software License 3.0
294 stars 66 forks source link

pander() Converts \item to \emph In Bulleted Lists #365

Closed drag05 closed 1 year ago

drag05 commented 1 year ago

Suddenly, a line of code in my script stopped working properly. The items in list are no-longer shown by line but as unaligned, italic text. Example:

pander::panderOptions('list.style', 'bullet')
pander::pander(list('letters' = LETTERS[1:9], 'numbers' = 1:9))

  * **letters**: _A_, _B_, _C_, _D_, _E_, _F_, _G_, _H_ and _I_
  * **numbers**: _1_, _2_, _3_, _4_, _5_, _6_, _7_, _8_ and _9_

<!-- end of list -->

Previously the same list was shown as:

* **letters**: 
* A
* B
* C
* D
*etc.
* **numbers**:
* 1
* 2
* 3
* 4
* etc.

Please advise, thank you!

daroczig commented 1 year ago

Any chance that your data structure changes? The first example output shows a list of vectors, while the second shows a list of lists. pander is a general S3 method that will use different methods for different classes.

To generate the 2nd output, you need a list of lists, e.g.

r$> pander::pander(list('letters' = as.list(LETTERS[1:9]), 'numbers' = as.list(1:9)))

  * **letters**:

      * A
      * B
      * C
      * D
      * E
      * F
      * G
      * H
      * I

  * **numbers**:

      * _1_
      * _2_
      * _3_
      * _4_
      * _5_
      * _6_
      * _7_
      * _8_
      * _9_

<!-- end of list -->

I suspect that your data structure changes, so closing the ticket, but pls reopen if you see an issue with pander.

drag05 commented 1 year ago

@daroczig No, data structure does not change. Funny thing is other scripts containing the same line of code

pander::pande(list( etc.

work just fine with the same data structure and with no need for nested list. In reality, the first term is actually the output of list.filest() which returns a character vector of various lengths depending on project source data. This script worked as usual until it started ignoring the 'list.style' = 'bullet' pander option: the TEX file shows \emph instead of \item for this list.

Thanks for the tip! I have implemented it and it works.