In a word document, I want single spaced footnotes while the body of the document is 1.5 spaced.
No matter what I try, the footnote spacing stays at 1.15 spacing instead of single spacing.
I've tried changing the style of the footnote and changing the padding around each line of the footnote (treating each as a different paragraph). Styles don't seem to work on footnotes and changing the padding to zero still left the default 1.15 space between each "paragraph."
My current code:
footnote1 = Footnote()
footnote1 = addParagraph( footnote1,
value = pot("footnote text",
textProperties(font.size = 10, font.family = "Arial"))
)
doc <- addParagraph( doc,
value = "\tparagraph text" +
pot("addfootnotehere.", footnote = footnote1 ) +
"more text.",
stylename = "NormalLeft",
bookmark = "paragraph1"
)
Your problem may be fixed if you used your own created template instead of the default doc <- docx().
Set up a template with the spacing required, save it, then call the newly created template with:
doc <- docx(template = 'D:/docs/template/my_corporate_template.docx')
then addFootnote should read your template sizing without auto correcting.
Related
I am having an issue where the data for my DT table is "bleeding" past the edge of the box in my fluid row.
Here is the tabPanel section
tabPanel("Table title", h1('dataset', style = 'color: #23A595'),
p('Here we will have a paragraph of explanatory text to talk about the graphs below. Here we will have a paragraph of explanatory text to talk about the graphs below. Here we will have a paragraph of explanatory text to talk about the graphs below. Here we will have a paragraph of explanatory text to talk about the graphs below. Here we will have a paragraph of explanatory text to talk about the graphs below.', style = 'color: black'),
fluidRow(
box(DT::dataTableOutput(outputId = "table"), width = NULL, solidHeader = TRUE, status = "primary"),
),
When the app is run here is the result of the render DT.
Here is what the data set looks like.
The red box highlights the issue.
Here is what i have tried:
First,
output$table<- renderDT(
outputtable,options = list(columns.width = "3px"
),
rownames= FALSE
)
Second,
fluidRow(box(DT::dataTableOutput(outputId = "table"),width = #),
)
I was under the impression that shiny just automatically calculates the size needed despite window size an such.
in simple terms, shiny creates box + add DT table to box = box with DT table INSIDE of it.
I want the highlighted issue to not happen what do I need to do?
If there is anything I can add let me know.
The scrollX comment above answered the question.
I have an rmarkdown document which output html. I have my own css styles that I use by adding it to the YAML header. I also want to control css of specific code chunks. I have a dashboard (3x2 grid of plots) that I want to have larger width than the main document.
I've found these two questions:
Add a CSS class to single code chunks in RMarkdown
Adding custom CSS tags to an RMarkdown html document
But neither of them are working for me (or I didn't understand the answers). I want to change the width of a plot so it float into the margins e.g. width: 110%. I tried this:
```{r dash1, fig.height=16, fig.width=14, results="asis"}
cat("
<style>
.toc-content {
width: 110%;
}
</style>
")
margin = theme(plot.margin = unit(c(1,2,1,2), "cm"))
pl_1 <- list(g_1_kaupmattur, g_2_gallup, g_3_vnv, g_4_spa, g_5_ibud, g_6_swirlo)
grid.arrange(grobs = lapply(pl_1, "+", margin), ncol = 2)
```
This changed the whole document, not only the output of this particular chunk.
I also tried creating a new css style with width: 110% and adding it to the chunk option like this:
```{r dash1, fig.height=16, fig.width=14, class.source="dash_styles"}
margin = theme(plot.margin = unit(c(1,2,1,2), "cm"))
pl_1 <- list(g_1_kaupmattur, g_2_gallup, g_3_vnv, g_4_spa, g_5_ibud, g_6_swirlo)
grid.arrange(grobs = lapply(pl_1, "+", margin), ncol = 2)
```
It didn't work either.
I would like the plot to extend to the margins as I "show" on the screenshot below.
I use the library (tcltk) in R to make the GUI. Code to create a button is :
tt <- tktoplevel()
button.widget <- tkbutton(tt, text = "", command = function())
I want the existing button on the GUI has an icon. How is the code to add the icon in the button using the library (tcltk) in R?
Use the tkimage.create function to create a Tcl-level representation of an image file. Note that there are some limitations on image formats and I believe GIF is the easiest to work with. Then, you specify the image as the image argument to tkbutton. Here's an example using, an Example.gif from Wikipedia:
library("tcltk")
img <- tclVar()
tclimg <- tkimage.create("photo", img, file = "Example.gif")
tt <- tktoplevel()
button.widget <- tkbutton(tt, text = "Click me!", image = tclimg, compound = "top",
command = function() tkmessageBox(message = "Hello!"))
tkgrid(button.widget)
You can control the relative placement of the image and text on the button using the compound argument:
"none" (display only the image if present, otherwise the text; the default)
"text" (text only)
"image" (image only)
"center" (text in center of image)
"top" (image above text)
"left" (image left of text)
"bottom" (image below text)
"right" (image right of text)
Using ReporteRs package we can create power point presenation from R code.
I tried to create a power point slide having a centered title.
Here the basic code I am using to create the slide:
library( ReporteRs )
mydoc = pptx( ) # try adding argument: template = 'template.pptx' here
mydoc = addSlide( mydoc, "Title and Content" )
mydoc = addTitle( mydoc, "This is a title" )
writeDoc( mydoc, "pp_simple_example.pptx" )
This creates a slide with title positioned at the left. Unfortunately addTitle don't expose any argument to format text or change its position. I looked also in the package options :
options()[grep('ReporteRs',names(options()))]
but without success.
One solution is to use a predefined template (as commented below my question)
To create a template:
Create a presentation
Choose a template where the text is centered. You can add a dummy slide with text and choose one from the predefined themes ( Design tab)
Don't forget to remove the slide. and save the presentation as basic_template.ppx
Now in the R code to use this template :
mydoc = pptx( template='basic_template.pptx') ## give the whole path here
I am using iTextSharp in my current project. I have created a table with some underlined data but my requirement is shown in this image:
http://postimg.org/image/402ap3acf/
How can I build this type of table.
I need the below structure.
A/C Some text TAT Some text
----------------- -----------------
The doted lines are underline.
The underline is controlled via the Font object and if you only want to set part of a Paragraph to be underlined you'll want to use a Chunk.
Here's a quick helper method for generating a font with different styles. You can change the actual font to whatever font you want to use.
Private Shared Function CreateFont(size As Integer, Optional style As Integer = iTextSharp.text.Font.NORMAL) As iTextSharp.text.Font
Return New iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.HELVETICA, size, style)
End Function
The style parameter takes integers from this list that you OR together:
iTextSharp.text.Font.NORMAL
iTextSharp.text.Font.BOLD
iTextSharp.text.Font.ITALIC
iTextSharp.text.Font.UNDERLINE
iTextSharp.text.Font.STRIKETHRU
So normal underlined text would be:
iTextSharp.text.Font.NORMAL Or iTextSharp.text.Font.UNDERLINE
You can use the above like this:
Dim P As New Paragraph()
P.Add(New Chunk("A/C ", CreateFont(12, iTextSharp.text.Font.NORMAL)))
P.Add(New Chunk("Some text", CreateFont(12, iTextSharp.text.Font.NORMAL Or iTextSharp.text.Font.UNDERLINE)))
EDIT
From iTextSharp's perspective, "underline" means "a line drawn underneath text". If there's no text there won't be an underline. A space, however, counts as text so you can just add extra spaces if you want like to continue the underline:
Dim P As New Paragraph()
P.Add(New Chunk("A/C ", CreateFont(12, iTextSharp.text.Font.NORMAL)))
P.Add(New Chunk("Some text ", CreateFont(12, iTextSharp.text.Font.NORMAL Or iTextSharp.text.Font.UNDERLINE)))