TransWikia.com

How to draw a solid colored circle?

TeX - LaTeX Asked by manish on August 27, 2020

I am working on some book writing. For that I need to draw circle filled with red color.

I tried circle but it generate black circle only. How can I fill it with color?

5 Answers

One easy way would be to use TikZ as in the following MWE

documentclass[a4paper,12pt]{scrartcl}
usepackage{tikz}

begin{document}
Some Text tikzdraw[red,fill=red] (0,0) circle (.5ex); further text
end{document}

which produces

enter image description here

Where the first red defines the line style of the drawn circle to be red and the fill=red specifies, that its solid red. You could also use black,fill=red to obtain a red circle with a black border. Finally of course the .5ex is the radius of the circle.

Correct answer by Ronny on August 27, 2020

documentclass{article}
usepackage{xcolor,pict2e}% to allow any radius
begin{document}
leavevmode
put(0,0){circle{20.6}}put(0,0){color{red}circle*{20}}

end{document}

Answered by user2478 on August 27, 2020

Another solution with TikZ, but this one creates a command tikzcircle to be used in the document:

newcommand{tikzcircle}[2][red,fill=red]{tikz[baseline=-0.5ex]draw[#1,radius=#2] (0,0) circle ;}%

It takes one mandatory argument, the radius of the circle and an optional argument that helps in customizing the circle's aspect.

The code:

documentclass[a4paper,11pt]{article}
usepackage{tikz}

newcommand{tikzcircle}[2][red,fill=red]{tikz[baseline=-0.5ex]draw[#1,radius=#2] (0,0) circle ;}%

begin{document}
This is my text tikzcircle{2pt} followed by tikzcircle[green, fill=blue]{1.5pt} some other text tikzcircle[fill=orange]{3pt} and some other text
end{document}

The result:

enter image description here

Answered by Claudio Fiandrino on August 27, 2020

newcommandfilledcirc{{color{red}bullet}mathllap{circ}} gives you a circ filled with red color. You need usepackage{mathtools} for the mathllap command.

To change the border color as well, just change the color of the circ, like so: newcommandfilledcirc{{color{red}bullet}mathllap{color{blue}circ}}.

The advantage over Tikz solutions is that it's much faster.

Answered by chs on August 27, 2020

Put these two lines right after the begin{document} command:

setlength{unitlength}{1mm}

newcommand{Newdot}{{leavevmodeput(0,.63){circle*{2.5}}}}

Then, anywhere in your document, you can put a big black dot with the Newdot command.

...
Newdot
...

This is for black dots. You can adjust the centering with the arguments of the put(*,*) command, and adjust the size of the dot with the argument of the circle*(*) command.

Color changes are addressed with color{*} command as explained in previous comments.

Answered by Motorfingers on August 27, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP