\seqsplit の単語にスペースを挿入します

\seqsplit の単語にスペースを挿入します
\documentclass{article}
\usepackage{tabularx,seqsplit}
\begin{document}

\begin{table}[h!]
\setlength\extrarowheight{2pt} % for a ever so slightly more open "look"
    \begin{tabularx}{\textwidth}{|c |c |c |X |X |X |}
    \hline
    1 & 2 & 3 & 
         \seqsplit{Testing 1 testing 2 Testing 3l} & 
         \seqsplit{Testing 1 testing 2 Testing 3} & 
         \seqsplit{Testing 1 testing 2 Testing 3} \\
         \hline
    1 & 2 & 3 & & & \\
    1 & 2 & 3 & & & \\
    \hline
    \end{tabularx}
\caption{tes}
\label{tab:my_label}
\end{table}

\end{document}

結果: ここに画像の説明を入力してください

言葉は

Testing 1 testing 2 Testing 3

しかし、それは

Testing1testing2Testing3

答え1

\hspace{0pt}まずスペースを「暗黙のスペース」に置き換え、次に各項目の後に追加してトークン リストをマップできます。

\documentclass{article}
\usepackage{tabularx}
\usepackage{xparse}

\ExplSyntaxOn
\NewDocumentCommand{\spliteverywhere}{m}
 {
  \tl_set:Nn \l__spliteverywhere_tl { #1 }
  \tl_replace_all:Nnn \l__spliteverywhere_tl { ~ } { \c_space_tl }
  \tl_map_function:NN \l__spliteverywhere_tl \__spliteverywhere:n
 }
\tl_new:N \l__spliteverywhere_tl
\cs_new:Nn \__spliteverywhere:n { #1 \hspace{0pt} }
\ExplSyntaxOff

\begin{document}

\begin{table}[h!]
\setlength\extrarowheight{2pt} % for a ever so slightly more open "look"
    \begin{tabularx}{\textwidth}{|c |c |c |X |X |X |}
    \hline
    1 & 2 & 3 & 
         \spliteverywhere{Testing 1 testingtesting 2 Testing 3l} & 
         \spliteverywhere{Testing 1 testing 2 Testing 3} & 
         \spliteverywhere{Testing 1 testing 2 Testing 3} \\
         \hline
    1 & 2 & 3 & & & \\
    1 & 2 & 3 & & & \\
    \hline
    \end{tabularx}
\caption{test}
\label{tab:my_label}
\end{table}

\end{document}

ここに画像の説明を入力してください

答え2

seqsplitはコンピュータコードなどの文字列を区切るためのもので、自然言語テキストの場合は TeX の通常の改行を使用する方が適切です。

ここに画像の説明を入力してください

\documentclass{article}
\usepackage{tabularx}
\begin{document}

\begin{table}[htp]
\setlength\extrarowheight{2pt} % for a ever so slightly more open "look"
    \begin{tabularx}{\textwidth}{|c |c |c |X |X |X |}
    \hline
    1 & 2 & 3 & 
         Testing 1 testing 2 Testing 3l & 
         Testing 1 testing 2 Testing 3 & 
         Testing 1 testing 2 Testing 3 \\
         \hline
    1 & 2 & 3 & & & \\
    1 & 2 & 3 & & & \\
    \hline
    \end{tabularx}
\caption{tes}
\label{tab:my_label}
\end{table}

\end{document}

関連情報