2

I am using acronym and mdframed packages and I when I use \acs{} inside of \begin{mdframed}[style=question] and \end{mdframed} I want it to have color "white". How can this be achieved?


Minimal example:

\documentclass[a4paper,10pt]{article}
\usepackage{acronym}
\usepackage{hyperref}
\usepackage{wallpaper}
\usepackage{graphicx}
\usepackage{listings}
\usepackage{acronym}
\usepackage{hyperref}

\hypersetup{
    colorlinks=true,
    linkcolor=linkcolor,
    citecolor=linkcolor,
    filecolor=linkcolor,
    urlcolor=linkcolor
}


\usepackage{color}
\definecolor{linkcolor}{RGB}{77,152,183}
\definecolor{questioncolor}{RGB}{179,179,179}
\definecolor{wantedcolor}{RGB}{180,190,0}

\usepackage[framemethod=TikZ]{mdframed}
\mdfdefinestyle{vprasanje}{%
    font=\normalsize,
    linecolor=questioncolor,
    outerlinewidth=0pt,
    roundcorner=2pt,
    innertopmargin=4pt,
    innerbottommargin=4pt,
    innerrightmargin=10pt,
    innerleftmargin=10pt,
    backgroundcolor=questioncolor}

\begin{document}

\section{Acronyms}

\begin{acronym}
\acro{UL}{University of Ljubljana}
\end{acronym}

\section{Random section}

\begin{mdframed}[style=vprasanje]
I want this acronym \acs{UL} to have different color than the one outside the mdframed environment. Perferably I want this one to have color defined above as "wantedcolor".
\end{mdframed}

I am outside of the invironment \acs{UL}!

\end{document}
  • Example, please? – egreg Oct 11 '16 at 22:00
  • I added the minimal example you requested. – 71GA Oct 11 '16 at 22:22
2

Among the many options of \mdfdefinestyle there is settings, which (quote from manual)

allows the user to commit some macros at the beginning of mdframed. The given material is executed before the savebox starts.

You can use this to locally redefine the linkcolor.

\mdfdefinestyle{vprasanje}{%
    font=\normalsize,
    linecolor=questioncolor,
    outerlinewidth=0pt,
    roundcorner=2pt,
    innertopmargin=4pt,
    innerbottommargin=4pt,
    innerrightmargin=10pt,
    innerleftmargin=10pt,
    backgroundcolor=questioncolor,
    settings={\definecolor{linkcolor}{RGB}{180,190,0}}}% <-- add this line

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.