3

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

3
  • 1
    So \facil should do 1. 2. and 3.? Commented Nov 17, 2012 at 23:48
  • Yes, \facil should be "1. * ", I mean, the counter followed by a dot, the middle circle and the thick space.
    – JnxF
    Commented Nov 17, 2012 at 23:49
  • Please see my updated answer. Is it something like that what you need? Commented Nov 17, 2012 at 23:51

2 Answers 2

4

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$}}~}
4

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}
2
  • 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
    Commented Nov 18, 2012 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. Commented Nov 18, 2012 at 0:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .