Closed lizzieinvancouver closed 4 years ago
@lizzieinvancouver I vaguely remember having similar problems at some point...I did have italicized species names in our budburst ms supp so look at the packages and code that i used there. If its not clear I can take a closer look and try to trouble shoot more! https://github.com/lizzieinvancouver/ospree/blob/bbculdesac/docs/budburst/budburstms.Rnw
@lizzieinvancouver below is my code excerpt. What i remember is that there was one particular package that, when loaded, conflicted with this code, but unfortunately i don't remember which package it was that conflicted. sp.st.table$Species<-gsub("."," ", sp.st.table$Species, fixed=TRUE) sp.st.table$Species<-paste0("\textit{", sp.st.table$Species, "}") sp.table <- xtable(sp.st.table, caption="\textbf{Species included in the OSPREE database.} See Table \ref{tab:ref} for reference associated with each dataset.", label="tab:sp",align=c( "p{0.01\textwidth}", "p{0.28\textwidth}", "p{0.1\textwidth}", "p{0.3\textwidth}")) print(sp.table, include.rownames=FALSE, hline.after = c(-1,0,nrow(sp.table)),caption.placement="top",tabular.environment = "longtable", floating = FALSE,align=c(rep('|c', ncol(sp.table)),'p{4in}'),tabular="\textwidth",include.colnames = TRUE, add.to.row = list(pos = list(0),command = "\hline \endhead "),sanitize.text.function = identity)
@lizzieinvancouver I think @AileneKane's code will work better for you! The only thing I will add, I had trouble when I tried using \textit{}, I had to add multiple backslashes in front. Ultimately, I ended up with four (so `\\\\textit{}' with the gsub) for it to translate to latex language.
@cchambe12 and @AileneKane ... it was actually really easy! I used Cat's code and then added from Ailene's sanitize.text.function = identity and it worked like a charm. Thank you!
I need help formatting the tables (which are xtables) in the supp of decsens. I want to italicize the species names. I tried making the species names the row names then following this example:
But I got an error about duplicate row names. @cchambe12 suggested this:
lstfrz$term <- gsub("speciesALNGLU", paste0("\\\\textit{","Alnus glutinosa","}"), lstfrz$term)
But @cchambe12 I could use some help! Do I need to this in R for each row then? I can, I just wanted to check.
And I wanted to ask how @AileneKane has dealt with this?
Also, my hline command is being ignored in the tables. Can anyone help with this?