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

Option for grey box around key bullets in each section? #203

Closed
carrieholt opened this issue Jan 18, 2022 · 9 comments
Closed

Option for grey box around key bullets in each section? #203

carrieholt opened this issue Jan 18, 2022 · 9 comments

Comments

@carrieholt
Copy link

Is it possible to generate grey boxes around key bullets in each section, as is in Kronlund et al. 2021 CSAS Res Doc: https://waves-vagues.dfo-mpo.gc.ca/Library/40998034.pdf

@seananderson
Copy link
Member

Maybe the tcolorbox package would work? See the part that starts with \begin{tcolorbox}[sharp corners, boxrule=0.2mm] below.

\documentclass{article}
\usepackage{lipsum}
\usepackage{lmodern}
\usepackage{tcolorbox}

\begin{document}
\lipsum[2]

\begin{tcolorbox}[sharp corners, boxrule=0.2mm]
\subsection*{Key Points:}

\begin{itemize}

\item The revised Fisheries Act includes new Fish Stocks provisions that introduced legal
obligations to manage major fish stocks at levels necessary to promote sustainability,
avoid limit reference points, and implement plans to rebuild stocks that have declined to,
or below, a limit reference point, all while taking into account the biology of the fish and
environmental conditions facing the stock.

\end{itemize}

\lipsum[2]
\end{tcolorbox}

\end{document}

image

There are a lot of options for formatting. https://tools.ietf.org/doc/texlive-doc/latex/tcolorbox/tcolorbox.pdf

You'd have to add

header-includes:
  - \usepackage{tcolorbox}

in the YAML header and it would only work in PDF output. We might be able to do it in Word output by creating a style.

Also, using the TeX environment would mean the text in between \begin{tcolorbox} and \end{tcolorbox} would have to be TeX not Markdown, I think. Perhaps we could create a marker that gets translated to \begin{tcolorbox} when the TeX code gets created to get around that.

@carrieholt
Copy link
Author

Thanks. This looks promising. However, I'm having difficulty downloading the tcolorbox, after adding - \usepackage{tcolorbox} in the Index file under header-includes.
Here's the error:
tlmgr.pl: package repository http://ctan.math.washington.edu/tex-archive/systems/texlive/tlnet (not verified: valid signature with expired key)
[1/1, ??:??/??:??] install: tcolorbox [226k]

TeXLive::TLUtils::check_file_and_remove: checksums differ for C:\Users\HoltC\AppData\Local\Temp\1\R9VPGGbimA\A1jSDMm3OI/tcolorbox.tar.xz:
...
TLPDB::_install_data: downloading did not succeed (check_file_and_remove failed) for http://ctan.math.washington.edu/tex-archive/systems/texlive/tlnet/archive/tcolorbox.tar.xz

I will try recreating the error in a blank csasdown template, and send to you (unless you have any initial thoughts)

@seananderson
Copy link
Member

Are you using tinytex in R for LaTeX or something else? tinytex::is_tinytex()

@carrieholt
Copy link
Author

carrieholt commented Jan 19, 2022

Yes, I'm using tinytex in R for LaTeX.

@seananderson
Copy link
Member

seananderson commented Jan 19, 2022

I'm not sure. This could be any number of TeX things from the server just being down when you tried it.

I assume:

tinytex::tlmgr_install("tcolorbox")

still fails?

You could try changing the texlive server:

tinytex::tlmgr_repo("https://ctan.math.ca/tex-archive/systems/texlive/tlnet")

I think the default is https://mirror.ctan.org/systems/texlive/tlnet, which should pick a mirror. It seems to be picking a US server for you but a Canadian one for me.

and then

tinytex::tlmgr_install("tcolorbox")

Although the above should work regardless, you could also check your texlive version:

tinytex::tlmgr_version()
#> tlmgr revision 60693 (2021-10-04 04:24:25 +0200)
#> tlmgr using installation: /Path/to/your/Library/TinyTeX
#> TeX Live (https://tug.org/texlive) version 2021

@carrieholt
Copy link
Author

Those didn't work. However I had this message, "tlmgr.pl: Local TeX Live (2020) is older than remote repository (2021).....
A new version of TeX Live has been released. If you need to install or update any LaTeX packages, you have to upgrade TinyTeX with tinytex::reinstall_tinytex().", so tried to update tinytex. Unfortunately, many of the tinytex packages won't install now (same problem with tcolorbox), so I am no longer able to able to knit. Perhaps there is back up somewhere, but the filing system is not intuitive to me.

The error message I get is: Please try from a different mirror and/or wait a few minutes and try again; usually this is because of transient updates. If problems persist, feel free to report to [email protected]

However, I'm not sure how to change the mirror (repository) in the installation of packages. E.g., tinytex::tlmgr_install ("nccmath")

@carrieholt
Copy link
Author

The entire error when I try to knit now is:

C:\Users\HoltC\AppData\Roaming\TinyTeX\texmf-dist\scripts\texlive\tlmgr.pl: signature verification error of C:/Users/HoltC/AppData/Roaming/TinyTeX/tlpkg/texlive.tlpdb.main.f5c4932332eb88bb88cf51695a8348dc from https://www.ctan.org/tex-archive/systems/texlive/tlnet/tlpkg/texlive.tlpdb: cryptographic signature verification of
C:\Users\HoltC\AppData\Local\Temp\1\cL2xykF652\JwfMEUcLWk
against
https://www.ctan.org/tex-archive/systems/texlive/tlnet/tlpkg/texlive.tlpdb.sha512.asc
failed. Output was:
gpg: Signature made Mon Jan 17 17:05:19 2022 PST using RSA key ID 19438C70
gpg: BAD signature from "TeX Live Distribution [email protected]"

Please try from a different mirror and/or wait a few minutes
and try again; usually this is because of transient updates.
If problems persist, feel free to report to [email protected].

! LaTeX Error: File `nccmath.sty' not found.

! Emergency stop.
<read *> flag __f

Error: LaTeX failed to compile resdoc.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See resdoc.log for more info.

@seananderson
Copy link
Member

You can set the repository back to what I think is the default with:

tinytex::tlmgr_repo("https://mirror.ctan.org/systems/texlive/tlnet")

which is probably worth doing. I think this is a problem on the texlive server side, but I'm not sure. E.g. rstudio/tinytex#213

Other possible mirrors: https://ctan.org/mirrors/mirmon

@carrieholt
Copy link
Author

Working now. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants