타자기 텍스트를 다른 행에 정렬

타자기 텍스트를 다른 행에 정렬

진행 상황을 추적하기 위해 문자와 문자 아래에 숫자가 포함된 표를 구성하고 있습니다.

\documentclass{article}
\usepackage{xcolor, placeins, cmbright}
\usepackage[margin=0.5in]{geometry}
\begin{document}
\small
\begin{tabular}{|c|c|c|} \hline
S & \texttt{\textcolor{gray}{E}\textcolor{teal}{T}\textcolor{teal}{M}\textcolor{teal}{W}\textcolor{green}{D}\textcolor{gray}{T}\textcolor{green}{K}\textcolor{teal}{K}\textcolor{teal}{E}\textcolor{green}{V}\textcolor{gray}{K}\textcolor{teal}{A}\textcolor{teal}{A}\textcolor{teal}{A}\textcolor{teal}{T}\textcolor{gray}{A}\textcolor{teal}{A}\textcolor{teal}{M}\textcolor{teal}{T}\textcolor{teal}{K}\textcolor{gray}{A}\textcolor{teal}{T}\textcolor{teal}{E}\textcolor{teal}{T}\textcolor{teal}{V}\textcolor{gray}{D}\textcolor{green}{N}\textcolor{teal}{K}\textcolor{green}{D}\textcolor{teal}{I}\textcolor{gray}{E}\textcolor{teal}{R}\textcolor{teal}{F}\textcolor{teal}{I}\textcolor{green}{P}\textcolor{gray}{S}\textcolor{teal}{L}\textcolor{teal}{I}\textcolor{teal}{Q}\textcolor{teal}{C}\textcolor{gray}{I}\textcolor{teal}{A}\textcolor{teal}{D}\textcolor{green}{P}\textcolor{teal}{T}E-\textcolor{gray}{-}\textcolor{teal}{V}\textcolor{teal}{P}\textcolor{teal}{E}\textcolor{teal}{T}\textcolor{gray}{V}\textcolor{teal}{H}\textcolor{teal}{L}\textcolor{green}{L}\textcolor{teal}{G}\textcolor{gray}{A}\textcolor{green}{T}\textcolor{green}{T}\textcolor{green}{F}\textcolor{green}{V}\textcolor{gray}{A}\textcolor{teal}{E}\textcolor{green}{V}\textcolor{teal}{T}\textcolor{teal}{P}\textcolor{gray}{A}\textcolor{teal}{T}\textcolor{green}{L}\textcolor{teal}{S}\textcolor{teal}{I}\textcolor{gray}{M}\textcolor{teal}{V}\textcolor{green}{P}\textcolor{teal}{L}\textcolor{green}{L}\textcolor{gray}{S}\textcolor{teal}{R}\textcolor{teal}{G}\textcolor{green}{L}\textcolor{teal}{N}\textcolor{gray}{E}\textcolor{teal}{R}E\textcolor{teal}{-}T-\textcolor{teal}{-}\textcolor{teal}{G}\textcolor{gray}{I}\textcolor{teal}{K}\textcolor{green}{R}\textcolor{teal}{K}\textcolor{teal}{S}\textcolor{gray}{A}\textcolor{teal}{V}\textcolor{teal}{I}\textcolor{teal}{I}\textcolor{teal}{D}} & 270
\\
S track & \texttt{176   -181   -186   -191   -196   -201   -206   -211   -216   ---221   -226   -231   -236   -241   -246   -251   -256   --259   -264   -269} & 270
\\
\hline\end{tabular}
\end{document}

이는 다음을 생성합니다.

여기에 이미지 설명을 입력하세요

하지만 보시다시피 두 열의 텍스트가 정렬되지 않습니다.

명확하게 하려면 위 1의 바로 아래에 있어야 합니다 E. 그러나 약간 왼쪽으로 이동했습니다. 또한 269잘못된 위치에 표시됩니다.

문제는 고정 폭이 있어도 공간이 다르게 취급된다는 것입니다.\texttt

나는 다음과 같은 다양한 곳에서 솔루션을 시도했습니다.테이블의 여러 행에 걸쳐 정렬(유일한 장소는 아님) 숫자를 정렬하는 방법을 알 수 없습니다.

큰 표에 글자와 숫자를 100열 너비의 셀로 만들어 보았지만 글자 사이의 공간이 너무 많아 표를 읽을 수 없게 되었습니다.

저도 시도해봤는데 flushleft실패했어요.

1LaTeX에게 를 바로 아래에 넣을 수 있는 방법이 있나요 E?

중앙 컬럼에서 사용하는 데 운이 좋았지 l만 중앙 컬럼의 오른쪽에서는 작동하지 않는 것 같습니다.

완성된 제품이 좋아 보이는 한 완전히 재설계할 의향이 있습니다.

답변1

정렬 불량의 주요 원인인 두 행의 요소 수가 동일하지 않습니다. 첫 번째 줄에는 100자가 있고 두 번째 줄에는 101자가 있습니다(공백을 포함하는 경우). 다음은 축어적인 시각적 자료입니다.

ETMWDTKKEVKAAATAAMTKATETVDNKDIERFIPSLIQCIADPTE--VPETVHLLGATTFVAEVTPATLSIMVPLLSRGLNERE-T--GIKRKSAVIID
176 -181 -186 -191 -196 -201 -206 -211 -216 ---221 -226 -231 -236 -241 -246 -251 -256 --259 -264 -269

더 읽기 쉽게 코드를 다시 작성하는 것이 가장 좋습니다. 그러면 실수를 더 잘 격리할 수 있습니다. 내용이 낯설어서 숫자에 맞게 너비를 나누었습니다.

\documentclass{article}

\usepackage{xcolor, cmbright}
\usepackage[margin=0.5in]{geometry}

\begin{document}

\small
\begin{tabular}{ | c | l | c | }
  \hline
  S & \ttfamily
      \textcolor{gray}{E}\textcolor{teal}{T}\textcolor{teal}{M}%
      \textcolor{teal}{W}\textcolor{green}{D}\textcolor{gray}{T}\textcolor{green}{K}%
      \textcolor{teal}{K}\textcolor{teal}{E}\textcolor{green}{V}\textcolor{gray}{K}%
      \textcolor{teal}{A}\textcolor{teal}{A}\textcolor{teal}{A}\textcolor{teal}{T}%
      \textcolor{gray}{A}\textcolor{teal}{A}\textcolor{teal}{M}\textcolor{teal}{T}%
      \textcolor{teal}{K}\textcolor{gray}{A}\textcolor{teal}{T}\textcolor{teal}{E}%
      \textcolor{teal}{T}\textcolor{teal}{V}\textcolor{gray}{D}\textcolor{green}{N}%
      \textcolor{teal}{K}\textcolor{green}{D}\textcolor{teal}{I}\textcolor{gray}{E}%
      \textcolor{teal}{R}\textcolor{teal}{F}\textcolor{teal}{I}\textcolor{green}{P}%
      \textcolor{gray}{S}\textcolor{teal}{L}\textcolor{teal}{I}\textcolor{teal}{Q}%
      \textcolor{teal}{C}\textcolor{gray}{I}\textcolor{teal}{A}\textcolor{teal}{D}%
      \textcolor{green}{P}\textcolor{teal}{T}E-%
      \textcolor{gray}{-}\textcolor{teal}{V}\textcolor{teal}{P}\textcolor{teal}{E}%
      \textcolor{teal}{T}\textcolor{gray}{V}\textcolor{teal}{H}\textcolor{teal}{L}%
      \textcolor{green}{L}\textcolor{teal}{G}\textcolor{gray}{A}\textcolor{green}{T}%
      \textcolor{green}{T}\textcolor{green}{F}\textcolor{green}{V}\textcolor{gray}{A}%
      \textcolor{teal}{E}\textcolor{green}{V}\textcolor{teal}{T}\textcolor{teal}{P}%
      \textcolor{gray}{A}\textcolor{teal}{T}\textcolor{green}{L}\textcolor{teal}{S}%
      \textcolor{teal}{I}\textcolor{gray}{M}\textcolor{teal}{V}\textcolor{green}{P}%
      \textcolor{teal}{L}\textcolor{green}{L}\textcolor{gray}{S}\textcolor{teal}{R}%
      \textcolor{teal}{G}\textcolor{green}{L}\textcolor{teal}{N}\textcolor{gray}{E}%
      \textcolor{teal}{R}E\textcolor{teal}{-}T%
      -\textcolor{teal}{-}\textcolor{teal}{G}\textcolor{gray}{I}\textcolor{teal}{K}%
      \textcolor{green}{R}\textcolor{teal}{K}\textcolor{teal}{S}\textcolor{gray}{A}%
      \textcolor{teal}{V}\textcolor{teal}{I}\textcolor{teal}{I}\textcolor{teal}{D} & 270 \\
  S track & \ttfamily
      176~%
      -181~%
      -186~%
      -191~%
      -196~%
      -201~%
      -206~%
      -211~%
      -216~%
      ---221~%
      -226~%
      -231~%
      -236~%
      -241~%
      -246~%
      -251~%
      -256~%
      --259~%
      -264~%
      -269 & 270 \\
  \hline
\end{tabular}

\end{document}

관련 정보