logo
down
shadow

Using the booktabs \midrule and with brackets


Using the booktabs \midrule and with brackets

By : user2951053
Date : November 18 2020, 01:01 AM
I wish this helpful for you OK, so I had the same problem with code generated from Pandoc (with bracket after \toprule), I fixed it by using \toprule{} instead, it seems that toprule eats the bracket otherwise. Maybe this will help you.
Another possibilty is to put empty \hbox{} before the opening bracket, which I used, since I could not modify tex produced by pandoc (but pandoc is capable of parsing latex snippets in markdown).
code :


Share : facebook icon twitter icon
troubles with \toprule and \midrule in siunitx table

troubles with \toprule and \midrule in siunitx table


By : Olivier Bernin
Date : March 29 2020, 07:55 AM
wish help you to fix your issue Having the following siunitx table code in LyX, for each occurrence of \toprule and \midrule I obtain an error message: , Adding
code :
\usepackage{booktabs}
Using booktabs with Rmarkdown

Using booktabs with Rmarkdown


By : user3785106
Date : March 29 2020, 07:55 AM
This might help you Try including a file header.tex in which you depend on the booktabs package. See the latex options for rmarkdown for details.
Edit: While the inclusion of headers is convenient and allows for wider ranging changes, here we get by with the top-level options tables: true. So the minimal change for the example above is
code :
---
title: "Testing booktabs"
author: "r.bot"
date: "June 11, 2015"
output: pdf_document
tables: true
---
Midrule in LaTeX output of Python Pandas

Midrule in LaTeX output of Python Pandas


By : Louis Richard
Date : March 29 2020, 07:55 AM
help you fix your problem Since pandas' .to_latex() does not seem to deliver such an option I would to this manually by some string handling:
code :
import pandas as pd
import numpy as np

# use a DataFrame df with some sample data
df = pd.DataFrame(np.random.random((5, 5)))

# get latex string via `.to_latex()`
latex = df.to_latex()

# split lines into a list
latex_list = latex.splitlines()

# insert a `\midrule` at third last position in list (which will be the fourth last line in latex output)
latex_list.insert(len(latex_list)-3, '\midrule')

# join split lines to get the modified latex output string
latex_new = '\n'.join(latex_list)
\begin{tabular}{lrrrrr}
\toprule
{} &         0 &         1 &         2 &         3 &         4 \\
\midrule
0 &  0.563803 &  0.962439 &  0.572583 &  0.567999 &  0.390899 \\
1 &  0.728756 &  0.452122 &  0.358927 &  0.426866 &  0.234689 \\
2 &  0.907841 &  0.622264 &  0.128458 &  0.098953 &  0.711350 \\
3 &  0.338298 &  0.576341 &  0.625921 &  0.139799 &  0.146484 \\
4 &  0.303568 &  0.495921 &  0.835966 &  0.583697 &  0.675465 \\
\bottomrule
\end{tabular}
\begin{tabular}{lrrrrr}
\toprule
{} &         0 &         1 &         2 &         3 &         4 \\
\midrule
0 &  0.563803 &  0.962439 &  0.572583 &  0.567999 &  0.390899 \\
1 &  0.728756 &  0.452122 &  0.358927 &  0.426866 &  0.234689 \\
2 &  0.907841 &  0.622264 &  0.128458 &  0.098953 &  0.711350 \\
3 &  0.338298 &  0.576341 &  0.625921 &  0.139799 &  0.146484 \\
\midrule
4 &  0.303568 &  0.495921 &  0.835966 &  0.583697 &  0.675465 \\
\bottomrule
\end{tabular}
xtable in Sweave: specify toprule or midrule in a table + alignement

xtable in Sweave: specify toprule or midrule in a table + alignement


By : Nick Hemond
Date : March 29 2020, 07:55 AM
around this issue From the documentation, use add.to.row in conjunction with hline.after=NULL to control what you add to the lines from the hline vector.
code :
library(xtable)
xtab <- xtable(data)

hline <- c(-1,0,nrow(xtab)-1,nrow(xtab))
htype <- c("\\toprule ", "\\midrule ", "\\toprule ","\\bottomrule ")

print(xtab,add.to.row = list(pos = as.list(hline),
                             command = htype),
      hline.after = NULL)
data <- structure(list(l = c(NA, NA, NA), w = c(515, 75, 85), a = c(0.22, 
0.45, 0.45), m = c(127.83, 33.75, 38.25)), class = "data.frame", row.names = c("x", "y", "z"))
R xtable with multicolumns and booktabs

R xtable with multicolumns and booktabs


By : honey
Date : March 29 2020, 07:55 AM
I hope this helps . I strongly recommend to use the amazing kableExtra package.
Related Posts Related Posts :
shadow
Privacy Policy - Terms - Contact Us © ourworld-yourmove.org