From 3bf49e25d8c17dee8a65a040c4c707625d73ce15 Mon Sep 17 00:00:00 2001 From: Eli Date: Mon, 31 Oct 2022 20:17:42 -0700 Subject: [PATCH] Add instructions for defining your own colors --- documentation/01-how-to-use-extension.qmd | 30 +++++++++++++++++++++-- documentation/02-titlepages.qmd | 27 +++++++++++++++++++- documentation/04-coverpages.qmd | 25 +++++++++++++++++-- documentation/05-coverpage-themes.qmd | 2 +- 4 files changed, 78 insertions(+), 6 deletions(-) diff --git a/documentation/01-how-to-use-extension.qmd b/documentation/01-how-to-use-extension.qmd index 79cac38..634fa5e 100644 --- a/documentation/01-how-to-use-extension.qmd +++ b/documentation/01-how-to-use-extension.qmd @@ -15,9 +15,9 @@ quarto use template nmfs-opensci/quarto_titlepages This will install the extension in the `_extension` folder plus all the demo files. Essentially, you will be cloning the repo into a new folder and you will be asked at installation for the name of the (empty) folder/directory that you want to install into. -### Install for an existing directory +### Install or update for an existing directory -You may also use this format with an existing Quarto project or document. This will install only the files in the `_extension` folder and will not install the files above that (the demo files). +You may also use this format with an existing Quarto project or document. This will install only the files in the `_extension` folder and will not install the files above that (the demo files). Use the same command to update an existing extension. From the quarto project or document directory, run the following command: @@ -114,5 +114,31 @@ format: lot: true ``` +## Colors + +The `xcolor` LaTeX package is used so you can define any color you want with a `xcolor` command. Then you can refer to this color where you want to specify a color. + +``` +format: + titlepage-pdf: + documentclass: scrbook + classoption: ["oneside", "open=any"] + number-sections: true + titlepage: "academic" + titlepage-footer: | + NOAA Fisheries OpenSci\ + Tools for Open Science\ + [https://github.com/nmfs-opensci](https://github.com/nmfs-opensci)\ + coverpage: "great-wave" + coverpage-theme: + title-node-spec: "fill=mygreen, inner sep=10mm, minimum height=4cm" + title-width: "8cm" + titlepage-theme: + footer-color: mygreen + keep-tex: true + include-in-header: + text: | + \definecolor{mygreen}{HTML}{808000} +``` diff --git a/documentation/02-titlepages.qmd b/documentation/02-titlepages.qmd index fbc5da4..b00cdc3 100644 --- a/documentation/02-titlepages.qmd +++ b/documentation/02-titlepages.qmd @@ -129,6 +129,15 @@ Available for page, title, subtitle, author, affiliation, header, footer, date. Do not use both `page-html-color` and `page-color`. Choose one. `page-color` will use names. What names are available? Google `latex xcolor`. Standard color names. +The `xcolor` LaTeX package is used so you can define any color you want with a `xcolor` command. Then you can refer to this color where you want to specify a color. You define the color in your LaTeX header. For example, define the color `mygreen` by including this in your format yaml and then you can use `mygreen` as a color name. + +``` + include-in-header: + text: | + \definecolor{mygreen}{HTML}{808000} +``` + + ### `-fontfamily` Available for page, title, subtitle, author, affiliation, header, footer, date. @@ -188,6 +197,14 @@ If `-style` is `colorbox`, you can specify the colorbox features: * `-colorbox-borderwidth` width of the border (in, cm, mm, pt) * `-colorbox-bordercolor` border color +The `xcolor` LaTeX package is used so you can define any color you want in your LaTeX header. For example, define the color `mygreen` include this in your format yaml. Then you can use `mygreen` as a color name. + +``` + include-in-header: + text: | + \definecolor{mygreen}{HTML}{808000} +``` + ### `bg-image-size` The background image size. Specify this with units like in, cm, mm, pt or as a fraction of the paper or text like `0.5\\paperwidth`. @@ -217,13 +234,21 @@ Add a fade to the image. Can be The vertical rule specifications are * `vrule-width` the width as in, cm, mm, pt (e.g. "1cm") or a fraction of the paper or text like `"0.1\\textwidth"`. -* `vrule-color` names of colors. It's the xcolors. +* `vrule-color` names of colors. It's the xcolors and you can define colors. * `vrule-align` left, right, leftright. The latter makes a rule on both sides. * `vrule-space-after` the gap between the vertical rule and the text * `vrule-text` text to put in the vertical rule * `vrule-text-color` color of the text * `vrule-text-style` text styles. See above on what styles are possible. +The `xcolor` LaTeX package is used so you can define any color you want in your LaTeX header. For example, define the color `mygreen` include this in your format yaml. Then you can use `mygreen` as a color name. + +``` + include-in-header: + text: | + \definecolor{mygreen}{HTML}{808000} +``` + ## All possible `titlepage-theme` values These are features that you can customize. If you leave it out, it will either not set the value (so use whatever defaults LaTeX has) or will choose a theme specific default. See the themes. diff --git a/documentation/04-coverpages.qmd b/documentation/04-coverpages.qmd index 637a28f..b2cdd46 100644 --- a/documentation/04-coverpages.qmd +++ b/documentation/04-coverpages.qmd @@ -60,7 +60,7 @@ Some text for the footer. Note "footer" doesn't mean it has to be at the bottom. ## Cover page element customization -The cover page has the following elements: page, title, author, header, footer, bg-image. Each of these can be customized via the `coverpage-theme`. +The cover page has the following elements: page, title, author, header, footer, date, bg-image. Each of these can be customized via the `coverpage-theme`. Example: ``` @@ -90,7 +90,15 @@ For title, author, header, footer, date, these can be Available for page, title, author, header, footer, date. -Do not use both `page-html-color` and `page-color`. Choose one. `page-color` will use names. What names are available? Google `latex xcolor`. Standard color names. +Do not use both `page-html-color` and `page-color`. Choose one. `page-color` will use names. + +The `xcolor` LaTeX package is used so you can define any color you want in your LaTeX header. For example, define the color `mygreen` include this in your format yaml. Then you can use `mygreen` as a color name. + +``` + include-in-header: + text: | + \definecolor{mygreen}{HTML}{808000} +``` ### `-fontfamily` @@ -152,6 +160,19 @@ Width of the box that holds the text. Smaller will mean that the text is wrapped *If you pass in `-left` for an element, you must also pass in `-width` for that element. Since you can pass in widths in any units, there is no way to compute a width for you. +### `-node-spec` + +Available for title, author, header, footer, date. + +These elements appear in the LaTeX file in tikz node. You can pass many different specifications to nodes. There are so many options. See https://tikz.dev/ or just try Googling tikz and what you want. + +Here is an example of putting the title in a red 4 cm high box with 10mm padding. Sadly, the width needs to be set by `title-width`. The other elements (footer, header, date) use the same format and will behave similarly. +``` + title-node-spec: "fill=red, inner sep=10mm, minimum height=4cm" + title-width: "8cm" +``` + + ### `bg-image-left` Distance from the left side of page to the left side of image. Measurement is in any units that LaTeX knows (in, cm, mm, pt) or something like `"0.5\\paperwidth"` or `"0.9\\textwidth"`. diff --git a/documentation/05-coverpage-themes.qmd b/documentation/05-coverpage-themes.qmd index c1cb91d..a3213da 100644 --- a/documentation/05-coverpage-themes.qmd +++ b/documentation/05-coverpage-themes.qmd @@ -1,6 +1,6 @@ ## Cover page themes -Cover pages can have title, author, header, and footer in any place on the page. You specify the location on the page. Title, author, header and footer blocks can be customized: font, font size, color, text rotation and style (bold, italic, etc). Cover pages can have a background image and the location, size and transparency can be specified. In addition, image fading at the top, bottom or sides can be specified. The page color can also be specified. +Cover pages can have title, author, header, and footer in any place on the page. You specify the location on the page. Title, author, header and footer blocks can be customized: font, font size, color, fill, text rotation and style (bold, italic, etc). Cover pages can have a background image and the location, size and transparency can be specified. In addition, image fading at the top, bottom or sides can be specified. The page color can also be specified. The following cover page demos are included.