Como definir a largura de \cancel

Como definir a largura de \cancel

Tenho 2 nós TikZ com largura de texto fixa:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage{cancel}
\begin{document}
\begin{tikzpicture}
\node[text width = 3cm] (1){text text text text text text text text text text text text};
\node[text width = 3cm, below = of 1.south]{\cancel{text text text text text text text text text text text text}};
\end{tikzpicture}
\end{document}

insira a descrição da imagem aqui

Pelo que entendi, \cancelo texto está dentro \hboxe o LaTeX não entende como dividi-lo em palavras.

É possível definir a largura também?

Responder1

Você poderia usar TikZ para desenhar a linha, dando um nome ao nó e usando as âncoras <nodename>.south weste <nodename>.north east.

insira a descrição da imagem aqui

\documentclass[border=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage{cancel}
\begin{document}
\begin{tikzpicture}
\node[text width = 3cm] (1){text text text text text text text text text text text text};
\node (canceled) [text width = 3cm, below = of 1.south]{text text text text text text text text text text text text};
\draw (canceled.south west) -- (canceled.north east);
\end{tikzpicture}
\end{document}

Responder2

Que tal agora:

\node[text width = 3cm, below = of 1.south]{\cancel{%
    \begin{minipage}{3cm}
    text text text text text text text text text text text text
    \end{minipage}%
}};

Captura de tela

informação relacionada