## LaTeX forum ⇒ Text Formatting ⇒ Custom/Macro Opacity Topic is solved

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
LaTexLearner
Posts: 139
Joined: Tue Mar 10, 2015 11:06 am

### Custom/Macro Opacity

Is there any way to set a custom opacity?

My laser printer just printed some documents I created and I realized that the opacity was too low. Now I have to go back and change a whole lot of opacity settings. If only I'd had a custom macro/setting for that... Is that possible?

Something like \newopacity{\answeropacity}{0.8}?

\documentclass{article} % This didn't work...%\newopacity{\answeropacity}{0.8} \usepackage{tikz} \begin{document} \begin{enumerate} \item Draw a length that represents two starting from zero. \tikz{  \draw (0,0)--(4,0);   \foreach \x in {0,...,4}   {    \draw (\x,-0.2)--(\x,0.2);    \node[below] at (\x,-0.3) {\x};   }  \fill[opacity=0.5] (0,0) rectangle (2,0.2);} \item Draw a length that represents four starting from zero. \tikz{  \draw (0,0)--(5,0);   \foreach \x in {0,...,5}   {    \draw (\x,-0.2)--(\x,0.2);    \node[below] at (\x,-0.3) {\x};   }  \fill[opacity=0.5] (0,0) rectangle (4,0.2);} \end{enumerate} \end{document}
Last edited by LaTexLearner on Mon Sep 21, 2015 2:58 am, edited 1 time in total.

Tags:

cgnieder
Site Moderator
Posts: 1993
Joined: Sat Apr 16, 2011 7:27 pm
Use

\newcommand{\answeropacity}{0.8}

\fill[opacity=\answeropacity]
site moderator & package author

LaTexLearner
Posts: 139
Joined: Tue Mar 10, 2015 11:06 am
Awesome. I look forward to trying that tonight.

LaTexLearner
Posts: 139
Joined: Tue Mar 10, 2015 11:06 am
Worked perfectly, thanks!