Risque palavras sobrepostas a palavras próximas

Risque palavras sobrepostas a palavras próximas

Eu descobri como adicionar palavras cruzadas comtcolorbox

\documentclass{article}\usepackage{xcolor} \usepackage[most]{tcolorbox}

\begin{document}

Of course, presenting this solution would be cheating. And, no, it won't work in all cases, due to strict limitations on the pairs 
\tcbox[tcbox raise base,
breakable,nobeforeafter, enhanced jigsaw, opacityback=0, sharp corners, parbox=false, boxrule=0pt, top=0pt,bottom=0pt,left=0pt,right=0pt, boxsep=0pt, frame hidden, parbox=false, 
  finish={\draw[thick,red] (frame.south west)--(frame.north east);\draw[thick,red] (frame.south east)--(frame.north west);}]{
  accepted
  }
  by \textbackslash{}line. Your professor surely knows that TeX doesn't draw oblique lines. With the standard package pict2e it's easier and it will work in any case.

\end{document}

insira a descrição da imagem aqui

Aqui eu risco a palavra aceitar. Porém, quero que a cruz se estique um pouco, digamos 1cm, veja minha ilustração.

insira a descrição da imagem aqui

Como posso conseguir isso?

Responder1

Você pode shortensuas falas.

encurtado

\documentclass{article}\usepackage{xcolor} \usepackage[most]{tcolorbox}

\tikzset{crossout/.style={thick,red,shorten >=-.5cm,shorten <=-.5cm}}

\begin{document}

Of course, presenting this solution would be cheating. And, no, it won't work in all cases, due to strict limitations on the pairs 
\tcbox[tcbox raise base,
breakable,nobeforeafter, enhanced jigsaw, opacityback=0, sharp corners, parbox=false, boxrule=0pt, top=0pt,bottom=0pt,left=0pt,right=0pt, boxsep=0pt, frame hidden, parbox=false, 
  finish={\draw[crossout] (frame.south west)--(frame.north east);\draw[crossout] (frame.south east)--(frame.north west);}]{
  accepted
  }
  by \textbackslash{}line. Your professor surely knows that TeX doesn't draw oblique lines. With the standard package pict2e it's easier and it will work in any case.

\end{document}

Responder2

Uma solução alternativa do TikZ (menos elegante que a do TeXnician).

Com overlayvocê pode escrever sobre algo sem ocupar espaço.

Já usei shiftpara ampliar as linhas (você pode usar shortentambém aqui, mas não usei porque o TeXnician já fez isso, por isso gostaria de mostrar uma alternativa).

Para alinhar os nós TikZ ao texto normal, veja aqui:Nó TikZ em texto normal.

\documentclass{article}\usepackage{xcolor} \usepackage{tikz}
\newcommand{\mycrossed}[1]{%
    \tikz[remember picture, baseline=(A.base)]{
        \node[inner sep=0pt](A){#1};
        }%
    \tikz[overlay, remember picture]{
        \draw[red, very thick] ([shift={(-.5,.2)}]A.north west) -- ([shift={(.5,-.2)}]A.south east);
        \draw[red, very thick] ([shift={(-.5,-.2)}]A.south west) -- ([shift={(.5,.2)}]A.north east);
        }%
    }
\begin{document}

Of course, presenting this solution would be cheating. And, no, it won't work in all cases, due to strict limitations on the pairs 
\mycrossed{accepted}
  by \textbackslash{}line. Your professor surely knows that TeX doesn't draw oblique lines. With the standard package pict2e it's easier and it will work in any case.
\end{document}

insira a descrição da imagem aqui

Responder3

Em maio de 2019 (pgf versão 3.1.3) tikz já possui o formato riscado em sua shapes.miscbiblioteca.

O código e a figura a seguir foram retirados da Seção 71.8 do manual.

\begin{tikzpicture}
\draw [help lines] (0,0) grid (3,2);
\node [cross out,draw=red] at (1.5,1) {cross out};
\end{tikzpicture}

insira a descrição da imagem aqui

informação relacionada