한 열의 모든 내용이 타자기 글꼴로 되어 있는 테이블을 만들려고 합니다. 즉, 다음과 같이 수행되어야 합니다.
\begin{tabular} {| l | p{5cm} |}
\hline
\multicolumn{2}{|l|}{Sample Table} \\ \hline
\texttt{left a} & right a \\ \hline
\texttt{left b} & right b \\ \hline
\texttt{left c} & right c \\ \hline
\end{tabular}
\texttt
그러나 모든 줄에 입력할 필요는 없습니다 . 그렇게 할 수 있는 방법이 있나요?
답변1
당신은 사용할 수 있습니다array
패키지 및 고급 컬럼 사양. 구문은 다음과 같습니다
>{before-code} column-type <{after-code}
where before-code
및 after-code
해당 열의 각 셀의 시작과 끝에서 (각각) 실행됩니다. 여기서는 다음을 사용해야 합니다.
>{\ttfamily}l
그 결과 셀이 타자기 글꼴로 조판된 왼쪽 정렬 열이 생성됩니다.
\documentclass{article}
\usepackage{array}
\begin{document}
\begin{tabular} {| >{\ttfamily}l | p{5cm} |}
\hline
\multicolumn{2}{|l|}{Sample Table} \\ \hline
left a & right a \\ \hline
left b & right b \\ \hline
left c & right c \\ \hline
\end{tabular}
\end{document}