Make \overrightarrow colored

It is possible to make \overrightarrow (the arrow itself not what is under it) colored? (LaTeX)

Replay

The following elementary redefinition inserts the appropriate colour, while setting whatever is underneath the arrow in \color{black}:

\documentclass{article}

\usepackage{amsmath,xcolor}

\let\oldoverrightarrow\overrightarrow
\renewcommand{\overrightarrow}[2][]{{%
\if$#1$\else\color{#1}\fi% Optional argument given...
\oldoverrightarrow{\color{black}#2}%
}}

\begin{document}

$A \quad \overrightarrow{\text{some text}} \quad B \quad \overrightarrow[red]{\text{some text}} \quad C$

\end{document}



If the preservation of the current colour is required, you can use the following definition:

\renewcommand{\overrightarrow}[2][]{%
{\colorlet{thecurrentcolour}{.}\if$#1$\else\color{#1}\fi%
\oldoverrightarrow{\color{thecurrentcolour}#2}%
}%
}



It stores the current colour - . as thecurrentcolour, and uses that (instead of black) for the text underneath the arrow.

Category: color Time: 2016-07-28 Views: 0
Tags: color arrows

Related post

• How can I make the color reverse application autostart when I log in? 2011-03-08

The application make the color reversed when i type super+m. I don't know what 's its name, and how can i make it start automatically when i log in? --------------Solutions------------- The application you are using is called compiz. Settings can mos

• How do pros manage to make the color green so bright in their nature photographs? 2012-02-27

I am an amateur photographer, I had a question how do professional photographers manage to make the green color so bright in their images. For example: http://www.flickr.com/photos/johnfrisch/5492742882/lightbox/ http://www.flickr.com/photos/kylehamm

• How to make these color effects? 2012-03-03

I am trying to design a logo that makes the color blend as on the image beneath. How do I do that? Any design guides or tips you can give me? http://www.colourlovers.com/business/trends/branding/7880/Papeterie_Haute-Ville_Logo --------------Solutions

• ListPlot3D - How to make the Color depending on a second list 2012-06-07

From a simulation (solid state physcis) i obtained a list1={{300,0,0},...} with x values=300,400,...,1500 and y-values=0,0.08,...,20 and z values. I plotted them using ListPlot3D. I want to investigate the change in z value for fixed y, i.e. does z v

• Make gcc coloring the default 2013-04-18

Is there a way to automatically make gcc color its output? I am looking to avoid an alias as the the command is commonly used in makefiles (where it will not be used). Is there an easy way to do this? Note: this does require gcc/g++ 4.9, which is cur

• How To Make Iris Color Picker Showed Up Over Form and Text? 2013-09-15

Is there a way to make wordpress default color picker (iris) showed up over form and text using wordpress api? Its inline display messing up the administration page of my plugin each time the color picker box showed up. --------------Solutions-------

• How do I make a color background transparent? 2013-12-27

This question already has an answer here: How do I blend a black-background fire image in Photoshop? 3 answers How I can make color transparent in Photoshop? For example, I have picture of smoke, and I want to make background color (which is black) t

• How to make a colored rounded text box? 2014-04-23

I would like to know which is the preferred way to make a colored, rounded text box? I would like to show important notes for example. --------------Solutions------------- A small example... \documentclass{book} \usepackage{blindtext} \usepackage{tco

• How to make right color compression for internet images? 2016-07-03

How to make right color/image compression for internet images? I adjust images in the Adobe Lightroom, then I export them to the Adobe Photoshop (there are already some changes - pictures looks more grainy then in the Lightroom). And after that, when

• How can I make my color printer default to black & white printing? 2009-07-31

I'm running Windows XP Home with an HP OfficeJet V40 color/black & white printer. It defaults to printing in color, which I rarely need. How can I make it default to black & white so that I don't have to keep manually changing the setting when I p

• How make dreamweaver color the code as php for .inc files 2010-03-03

I have php code written in test.inc file but dreamweaver is showing no color highlighting. Is there any way to make them same color code as .php extension --------------Solutions------------- You'll have to add the .inc extension to MMDocumentTypes.x

• How to make the colors of an image taken under diffuse midday light more lively? 2012-02-07

I took some macro shots of flowers in a greenhouse. I did it around midday in January, and the ceiling of the greenhouse was matted glass, so I got very diffuse light. Even in images which are exposed far to the right, there is a greyish, sad feel to

• How would I make a colored alert box in LaTeX? 2012-02-12

I would like to make something similar to the following green alert box http://twitter.github.com/bootstrap/components.html#alerts I have tried various combinations of verbatim without success --------------Solutions------------- You can use a color

• How to make a color gradient in a Word 2010 table cell 2012-09-21

I would like to make a gradient background in a Word 2010 table cell. Unfortunately, Word only provides solid color filling and premade patterns. There does not seem to be an easy way of doing this. The best method I have come up with is to use the d

• How to make a color appear the same on different backgrounds? 2013-01-30

Background on color perception: Due to the nature of the human eye and visual processing by the brain, there's an optical illusion that the same color will look different depending on the background. It is known as the contrast effect, illustrated be

• Why does Illustrator make the colors darker with 3D effects? 2013-02-11

I am trying to adjust colors after I apply a 3D effect (say extrude & bevel) in Adobe Illustrator (I tried in CS2 and CS5) but even if I make the object's color white it turns into fairly dark gray after the effect; I cannot make it lighter. I tried

• How to make ls color its output by default, without setting up an alias? 2013-10-25

I don't want an alias (alias ls='ls --color'), and I had previously set this up on Mac OSX using CLICOLOR environment variable which magically brought colors to ls. Now I am on Linux (Arch x86-64) with xterm and a really basic setup, and I can't make

• How do I make a colored background section like the code section on StackExchange? 2014-04-16

I'm looking for a way to create text paragraphs formatted similarly to the way StackExchange sites format code sections: Example section with background color different from main text's. Length of individual lines doesn't matter. I only found how to

• Want to make the colorful table in LaTeX 2014-06-17

I make this Table MS Word. But I am interest to make this Table in LaTeX % Table generated by Excel2LaTeX from sheet 'Sheet2' \begin{table}[htbp] \centering \caption{Add caption} \begin{tabular}{rcrrr} %\toprule \multirow{2}[2]{*}{} & \textbf{} &