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

Sublist in a Table Causes Random Pipe Symbols to Appear #356

Closed amarakon closed 2 years ago

amarakon commented 2 years ago

Here is my code block:

topic = c("Physical health", "Relationships", "Violence / crime", "Costs to society")
impact = c("- slurred speech\n- unsteady movement\n- disturbed perceptions\n- inability to react quickly",
        "- causes the inability to feel pain\n- makes you feel “stupid”\n- negatively impacts relationships",
        "- some people drink and drive\n    - drinking and driving is extremely dangerous\n - alcohol makes you lose coordination and control.",
        "- many people in society think it's cool to drink alcohol but it's wrong to do drugs   - this is only half correct, as both drinking alcohol and doing drugs are wrong\n   - alcohol has a lot of negative effects just like drugs do")
column_3 = c("Example text", "Example text", "Example text", "Example text")

alcohol = data.frame(topic, impact, column_3)

pander(alcohol, keep.line.breaks = TRUE, style = 'grid', justify = 'left', caption="Alcohol", col.name=c("Topic", "Impact", "Column 3"))

Here is a screenshot of the output:\ https://imgur.com/Fo20A8M

As you can see, in column 3, there are random pipe symbols in the cells. This is weird, but I think I know why it's happening. I put sublists in my cells by writing "\nTab- text". The sublists work properly, but it causes pipe symbols to appear in the third column. When I remove the sublists, the pipe symbols are gone.

amarakon commented 2 years ago

I fixed this by using LaTeX's enumerate to add sublists.