Posts

Showing posts with the label Latex

Align Multiple Tables Side By Side

Image
Answer : Just put two data frames in a list, e.g. t1 <- head(mtcars)[1:3] t2 <- head(mtcars)[4:6] knitr::kable(list(t1, t2)) Note this requires knitr >= 1.13. I used this Align two data.frames next to each other with knitr? which shows how to do it in html and this https://tex.stackexchange.com/questions/2832/how-can-i-have-two-tables-side-by-side to align 2 Latex tables next to each other. It seems that you cannot freely adjust the lines of the table as you can do it with xtable (does anybody know more about this?). With format = Latex you get a horizontal line after each row. But the documentation shows two examples for other formats. One using the longtable package (additional argument: longtable = TRUE ) and the other using the booktabs package ( booktabs = TRUE ). --- title: "sample" output: pdf_document header-includes: - \usepackage{booktabs} --- ```{r global_options, R.options=knitr::opts_chunk$set(warning=FALSE, message=FALSE)} ``` ```{r s...

Automatizing PSfrag Export

Image
Answer : Let me try to give you some hints. Problem 1. When you look at a specific tick in a Graphics it usually looks similar to the following {200., 200., {0.00625, 0.}, {GrayLevel[0.], AbsoluteThickness[0.25]}} it means, at position 200 draw the number 200. The next list is the specification of the tick-length and then follows a list of graphic-directives to use. I assume if you convert the label into another form, like a string, you may have more luck with your approach. Let's try something transformTick[{pos_, label_, length_List, spec_List}] := {pos, ToString[label, TraditionalForm], length, spec} p1 = Plot[x^2, {x, 0, 1000}, Frame -> True] p2 = Show[p1, FrameTicks -> Map[transformTick, FrameTicks /. AbsoluteOptions[p, FrameTicks], {2}]] It seems the Ticks are a bit smaller and the dot after the number does not appear in the original but otherwise it looks OK for me. If you now compare ImportString[ExportString[#, "EPS"], "EPS...