Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow italic and bold within column texts [skip ci] #64

Merged
merged 5 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: labeleR
Title: Automate the Production of Custom Labels, Badges, Certificates, and Other Documents
Version: 0.1.2
Version: 0.1.3
Authors@R:
c(
person("Ignacio", "Ramos-Gutierrez",, "[email protected]", role = c("aut", "cre", "cph"),
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# labeleR 0.1.3

* Allow bold and italic text within column texts

# labeleR 0.1.2

* Title added to .Rmd templates (changed in .yaml files).
Expand Down
3 changes: 3 additions & 0 deletions R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ check_latex<- function(df = NULL, column=NULL){
df[[column]] <- gsub("}", "\\\\}", df[[column]])
df[[column]] <- gsub("~", "-" , df[[column]]) #unable to render with \\~
df[[column]] <- gsub("\\^", "\\\\^" , df[[column]])#name truncated and accent to the next letter
df[[column]] <- gsub("\\textit" , "\\textit{" , df[[column]], fixed = T)#open italize
df[[column]] <- gsub("\\textbf" , "\\textbf{" , df[[column]], fixed = T)#open bold
df[[column]] <- gsub("\\end", "}" , df[[column]], fixed = T)#close italize AND bold
return(df[,column, drop=FALSE])
}

Expand Down
79 changes: 66 additions & 13 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ editor_options:

<!-- README.md is generated from README.Rmd. Please edit that file -->


```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
Expand Down Expand Up @@ -41,16 +40,16 @@ package you need! Keep an eye on this easy tutorial on how to use it!

## Installing labeleR

To install the latest stable version of **labeleR** from CRAN, just use
To install the latest stable version of **labeleR** from CRAN, just use
`install.packages()` function.

```{r install labeleR CRAN, eval=F}
install.packages("labeleR")
```

However, if you want to install the latest version of **labeleR** from GitHub,
you might need to install the *devtools* package. Once you have it,
you just have to specify the repository and install!
However, if you want to install the latest version of **labeleR** from
GitHub, you might need to install the *devtools* package. Once you have
it, you just have to specify the repository and install!

```{r install labeleR GH, eval=F}
# install.packages("devtools")
Expand Down Expand Up @@ -356,9 +355,9 @@ including a QR code (fixed or variable), a logo image. Field 1 will be
capitalized (as in `family.column` in the herbarium label, and Field 2
italicized). Any of the fields can be left blank.

As a novelty, the user may manually fix the backgroud and text colors
to their preference, using HTML color codes (same code as HEX, but
without the '\#'). By default, background colors are two hues of green.
As a novelty, the user may manually fix the backgroud and text colors to
their preference, using HTML color codes (same code as HEX, but without
the '\#'). By default, background colors are two hues of green.

+-----------------------------------------------------------------------+
| ![Collection labels (blank)](man/figures/collection_labels_blank.png) |
Expand Down Expand Up @@ -430,16 +429,70 @@ create_tiny_label(
| ![Tinylabels example](man/figures/tinylabels.png) |
|---------------------------------------------------|

## 3. Frequently Asked Questions

### Including italic or bold texts within a single text

This implementation should be used just to change text formats in only a
part of values stored in columns (variable parameters).

To do so, you must edit the cell value, specifying where the italics text must start
with `\\textit`, and `\\end` where it ends; and `\\textbf` followed by
`\\end` for bold text. In case you want to combine both, you will have
to specify `\\end` twice.

For example, this could be helpful to
include italics in a species name which is included as part of a title;
where just the species name should be italicized.

```{r custom italics, eval=FALSE}
seminar.table <- data.frame(
"Name" = "Rubeus Hagrid",
"Date" = "01/01/1996",
"Title" = "Population dynamics of a species of giant spider
(\\textitAcromantula gigantea\\end) in Hogwart's Forbidden Forest",
"Comm.type" = "seminar",
"Affil" = "Hogwarts Keeper of Keys and Grounds")

create_participation_certificate(
data = seminar.table,
path = "labeleR_output",
filename = "participation_certificates",
language = "English",
name.column = "Name",
affiliation.column = "Affil",
comm.type.column = "Comm.type",
title.column = "Title",
date.column = "Date",
type = "online",
event = "seminar",
freetext = "organized by Hogwarts School of Magic and Wizardry",
signer = "A.P.W.B. Dumbledore",
signer.role = "School Headmaster",
rpic = system.file("rmarkdown/pictures/Hogwarts_logo.png", package = "labeleR"),
lpic = system.file("rmarkdown/pictures/MinMagic.png", package = "labeleR"),
signature.pic = system.file("rmarkdown/pictures/dumbledore.png", package = "labeleR")
)

```

+-----------------------------------------------------------------------+
| ![Custom italics |
| example](man/figures/Participation_certificate_italics.png) |
+=======================================================================+
| |
+-----------------------------------------------------------------------+

## Citation

```{r citation, eval=TRUE, comment=NA, echo=FALSE}
```{r citation, eval=TRUE}
citation("labeleR")
```

## Funding

The development of this software has been funded by the European Union -
Next Generation EU, Fondo Europeo de Desarrollo Regional (FEDER) and
Consejería de Transformación Económica, Industria, Conocimiento y Universidades
of Junta de Andalucía (proyecto US-1381388 led by Francisco Rodríguez Sánchez,
Universidad de Sevilla).
Next Generation EU, Fondo Europeo de Desarrollo Regional (FEDER) and
Consejería de Transformación Económica, Industria, Conocimiento y
Universidades of Junta de Andalucía (proyecto US-1381388 led by
Francisco Rodríguez Sánchez, Universidad de Sevilla).
78 changes: 66 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -408,23 +408,77 @@ create_tiny_label(
| ![Tinylabels example](man/figures/tinylabels.png) |
|---------------------------------------------------|

## Citation
## 3. Frequently Asked Questions

### Including italic or bold texts within a single text

This implementation should be used just to change text formats in only a
part of values stored in columns (variable parameters).

To cite package 'labeleR' in publications use:
To do so, you must edit the cell value, specifying where the italics
text must start with `\\textit`, and `\\end` where it ends; and
`\\textbf` followed by `\\end` for bold text. In case you want to
combine both, you will have to specify `\\end` twice.

Ramos-Gutierrez I, de Aledo JG, Rodríguez-Sánchez F (2023). _labeleR:
Automate the Production of Custom Labels, Badges, Certificates, and
Other Documents_. <https://EcologyR.github.io/labeleR/>.
For example, this could be helpful to include italics in a species name
which is included as part of a title; where just the species name should
be italicized.

A BibTeX entry for LaTeX users is
``` r
seminar.table <- data.frame(
"Name" = "Rubeus Hagrid",
"Date" = "01/01/1996",
"Title" = "Population dynamics of a species of giant spider
(\\textitAcromantula gigantea\\end) in Hogwart's Forbidden Forest",
"Comm.type" = "seminar",
"Affil" = "Hogwarts Keeper of Keys and Grounds")

@Manual{,
title = {labeleR: Automate the Production of Custom Labels, Badges, Certificates, and Other Documents},
author = {Ignacio Ramos-Gutierrez and Julia G. {de Aledo} and Francisco Rodríguez-Sánchez},
year = {2023},
url = {https://EcologyR.github.io/labeleR/},
}
create_participation_certificate(
data = seminar.table,
path = "labeleR_output",
filename = "participation_certificates",
language = "English",
name.column = "Name",
affiliation.column = "Affil",
comm.type.column = "Comm.type",
title.column = "Title",
date.column = "Date",
type = "online",
event = "seminar",
freetext = "organized by Hogwarts School of Magic and Wizardry",
signer = "A.P.W.B. Dumbledore",
signer.role = "School Headmaster",
rpic = system.file("rmarkdown/pictures/Hogwarts_logo.png", package = "labeleR"),
lpic = system.file("rmarkdown/pictures/MinMagic.png", package = "labeleR"),
signature.pic = system.file("rmarkdown/pictures/dumbledore.png", package = "labeleR")
)

```

| ![Custom italics example](man/figures/Participation_certificate_italics.png) |
|------------------------------------------------------------------------------|
| |

## Citation

``` r
citation("labeleR")
#>
#> To cite package 'labeleR' in publications use:
#>
#> Ramos-Gutierrez I, de Aledo JG, Rodríguez-Sánchez F (2023). _labeleR:
#> Automate the Production of Custom Labels, Badges, Certificates, and
#> Other Documents_. <https://EcologyR.github.io/labeleR/>.
#>
#> A BibTeX entry for LaTeX users is
#>
#> @Manual{,
#> title = {labeleR: Automate the Production of Custom Labels, Badges, Certificates, and Other Documents},
#> author = {Ignacio Ramos-Gutierrez and Julia G. {de Aledo} and Francisco Rodríguez-Sánchez},
#> year = {2023},
#> url = {https://EcologyR.github.io/labeleR/},
#> }
```

## Funding

Expand Down
2 changes: 1 addition & 1 deletion inst/CITATION
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ bibentry(
bibtype = "Manual",
title = "labeleR: Automate the Production of Custom Labels, Badges, Certificates, and Other Documents",
author = c("Ignacio Ramos-Gutierrez", "Julia G. de Aledo", "Francisco Rodríguez-Sánchez"),
year = "2023",
year = "2024",
url = "https://EcologyR.github.io/labeleR/",
)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading