Re: inserire caselle con la spunta

#84897
Up
0
Down
::


Ah beh.. se c’è una soluzione con [tt]\ooalign[/tt] mi sento quasi in dovere di dare una soluzione con TikZ 😉 `
\documentclass{article}
\usepackage{amssymb,tikz}
\usetikzlibrary{calc,fadings}

\def\mark{mark}
\def\nomark{no mark}

\begin{tikzfadingfrompicture}[name=tikz]
\node [text=transparent!5]{$\checkmark$};
\end{tikzfadingfrompicture}

\tikzset{box/.style={
rectangle,
draw,
minimum size=0.225cm,
inner sep=1pt,
},
insert mark/.style={
append after command={%
\pgfextra{%
\begin{pgfinterruptpath}
\shade[path fading=tikz,
fit fading=false,
mark style]
($(\tikzlastnode.south east)-(0,0.0075)$)
rectangle ($(\tikzlastnode.north west)-(0,0.0075)$)
;%
\end{pgfinterruptpath}
}%
}
},
mark style/.style={
left color=black,
right color=black
},
}

\newcommand{\marksetstyle}[1]{
\tikzset{mark style/.append style={#1}}
}

\newcommand{\tikzcheckmark}[1][mark]{%
\def\check{#1}%
\ifx\check\mark%
\tikz[baseline=-0.5ex]\node[box,insert mark]{};%
\fi%
\ifx\check\nomark%
\tikz[baseline=-0.5ex]\node[box]{};%
\fi%
}

\begin{document}

\tikzcheckmark\quad\tikzcheckmark[no mark]\par

\vspace{1ex}

\marksetstyle{top color=orange, bottom color=blue!80!cyan}
\tikzcheckmark\quad\tikzcheckmark[no mark]\par

\vspace{1ex}

\marksetstyle{top color=red,bottom color=yellow!60!orange}
\tikzcheckmark\quad\tikzcheckmark[no mark]

\vspace{1ex}

\marksetstyle{left color=green,right color=red,middle color=white}
\tikzcheckmark\quad\tikzcheckmark[no mark]

\vspace{1ex}

\marksetstyle{top color=magenta!60!red,bottom color=blue}
\tikzcheckmark\quad\tikzcheckmark[no mark]

\vspace{1ex}

\marksetstyle{inner color=yellow!60!orange,outer color=magenta!50!blue}
\tikzcheckmark\quad\tikzcheckmark[no mark]
\end{document}
` Il risultato:

[attachment=671]Senzanome_2013-04-15.jpg[/attachment]

Ovviamente è del tutto superfulo usare TikZ per uno scopo del genere, a meno che non si vogliano ottenere quei particolari effetti “sfumando” il colore della spunta.

Ciao
Claudio

Attachments:
You must be logged in to view attached files.

Go to top