TransWikia.com

Correct syntax for using setstretch{} color{} textit{} and scriptsize in same macro?

TeX - LaTeX Asked on October 3, 2021

I am writing a custom macro to display text as footnotes for some custom figures and pictures in my R markdown code, using latex. I need to have scriptsize fontsize, decreased line spacing than rest of document (rest of document is default – I have not set any spacing command for it), gray text color and italics in part of the note. .Rmd file code is below:

---
output:
  pdf_document:
    latex_engine: pdflatex
    fig_caption: yes
    keep_tex: yes
documentclass: article
header-includes: usepackage{setspace}
                 usepackage{array}
---

newcommand{greynote}[1]{
    {scriptsize
    color{darkgray}{setstretch{0.9}{textit{Notes:} #1}
 }
}
}

**Blah blah**  
**Blah blah**  
**Blah blah**  
**Blah blah**  
**Blah blah**  

greynote{Values indicate percentage of respondents who agree or strongly agree with the prompt. Acceptability of absence means percentage of employees who believe that absence is acceptable if there is no more work, or if they are doing something good for their communities. The data has been collected in the Jan-June 2020 period.}

I get below error when I knit the pdf:

! Undefined control sequence.
l.84     color
               {darkgray}{setstretch{0.9}{textit{Notes:} Values indicate p..

How do I define the macro correctly? I have rearranged color and setstretch but it does not work.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP