Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to do a command in LaTeX named \facil where:

  1. I read the counter ejercicio, I add 1 to it and I display it with sans-serif font, and then write down a dot. I've previously created it in the preamble, and the code I've done:

    {%
    \sffamily\arabic{ejercicio}%
    \addtocounter{ejercicio}{1}.%
    }%
    
  2. Then write a space with "\ " (without quotes) and draw a blue circle (or point) where is exactly in the middle of the line, with color blue!25!black and minimum size=1ex. That's what I don't know how to do it, I've tried with baseline option but I haven't done anything right.

  3. Write a large space "\;" (the text "Representa en forma..." is not part of the command).

An image of what I want to do:

enter image description here

share|improve this question
1  
So \facil should do 1. 2. and 3.? –  Gonzalo Medina Nov 17 '12 at 23:48
    
Yes, \facil should be "1. * ", I mean, the counter followed by a dot, the middle circle and the thick space. –  JnxF Nov 17 '12 at 23:49
    
Please see my updated answer. Is it something like that what you need? –  Gonzalo Medina Nov 17 '12 at 23:51
    
Yes, it's quite what I wanted. Thanks. –  JnxF Nov 17 '12 at 23:54
add comment

2 Answers

up vote 4 down vote accepted

Something like this?

\documentclass{article}
\usepackage{xcolor}

\newcounter{ejercicio}
\newcommand\facil{%
  \stepcounter{ejercicio}{\sffamily\theejercicio.}~\textcolor{blue!25!black}{$\bullet$}~}

\begin{document}

\facil Representa en forma de intervalo...

\end{document}

enter image description here

Using \raisebox and/or \scalebox from the graphicx package you can change the attributes for the \bullet; for example:

\usepackage{graphicx}
\usepackage{xcolor}

\newcounter{ejercicio}
\newcommand\facil{%
  \stepcounter{ejercicio}{\sffamily\theejercicio.}~\textcolor{blue!25!black}{\scalebox{1.2}{$\bullet$}}~}
share|improve this answer
add comment

Since you did not provide a complete MWE, I am guessing the problem with what you were attempting was to apply baseline to the \draw, or \node. It needs to be applied to the \tikz. Here is what I think you were doing incorrectly (shown in red) and a way to fix it:

enter image description here

References:

Code:

\documentclass{article}

\usepackage{tikz}
\newcounter{ejercicio}

\newcommand{\Oldfacil}{%
    \addtocounter{ejercicio}{1}%
    \sffamily\arabic{ejercicio}.~%
    \tikz \draw [fill=red, yshift=0.75ex] (0,0) circle (2pt);~%
}%

\newcommand{\facil}{%
    \addtocounter{ejercicio}{1}%
    \sffamily\arabic{ejercicio}.~%
    \tikz[baseline] \draw [fill=blue!25!black, yshift=0.75ex] (0,0) circle (2pt);~%
}%
\begin{document}
\Oldfacil Baseline applied to \verb|\draw|

\facil Baseline applied to \verb|\tikz|
\end{document}
share|improve this answer
    
I think it also a good solution. I can ask you from my ignorance why are you using .75 ex, and not other distance? –  JnxF Nov 18 '12 at 0:01
    
I adjusted that value so that it looked right, and used the ex units so that it will adjust if the font size is changed. –  Peter Grill Nov 18 '12 at 0:03
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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