\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}

관련 정보