
나는 이것이 어리석은 질문으로 들릴 수도 있다는 것을 알고 있지만 나는 LaTeX의 초보자입니다.
\begin{table}[H]
\centering
\begin{tabular*}{\textwidth}{|c|}
\hline
\begin{tabular}[c]{@{}l@{}}
\textbf{\textbf{Description sommaire}}:
\end{tabular}
\\ \hline
\end{tabular*}
\end{table}
표를 페이지 너비로 강제 조정하려고 합니다. 나는 {tabular*}
그것을 사용했고 효과가있었습니다. 하지만 이제 국경에 문제가 생겼습니다. 왼쪽 테두리는 정상적으로 표시되지만 오른쪽 테두리는 잘못 재생됩니다.
내 테이블에는 열이 하나만 있고 오른쪽 테두리가 테이블의 오른쪽 끝에 있기를 원합니다. 어떻게 해야 합니까?
답변1
tabular*
표를 전체 텍스트 너비로 확장하는 기능을 활용하려면 따라야 하는 특수 구문이 있습니다. 필수 구문은 다음과 같습니다.
\begin{table}[htbp]
\centering
\begin{tabular*}{\textwidth}{|c|@{\extracolsep{\fill}}c|}
\hline
\textbf{\textbf{Description sommaire}}: & \\ \hline
\end{tabular*}
\end{table}
그렇지 않은 경우에는 보다 일반적인 tabularx
환경을 사용하십시오(권장함).
\begin{table}[htbp]
\centering
\begin{tabularx}{\textwidth}{|c|X|}
\hline
\textbf{\textbf{Description sommaire}}: & \\ \hline
\end{tabularx}
\end{table}
이는 동일한 결과와 보너스로 텍스트 줄 바꿈을 제공합니다.
답변2
액자 섹션 같은 제목을 만들려고 하시나요?
그렇다면 float (a table
)를 만드는 것이 더 나쁜 아이디어이기 때문입니다. 제목을 어디로든 옮길 수 있습니다. 옵션을 사용하면 [H]
플로트가 뜨지 않도록 만들 수 있지만 여전히 table
환경은 전혀 필요하지 않습니다. 수직 공백을 추가하여 테이블 들여쓰기를 방지하기 위해 이를 사용하고 있을 수도 있지만 이는 부동 소수점 없이 더 잘 해결될 수 있습니다(각각 \noindent
수직 간격 명령을 로 사용하거나 0pt 이상으로 \bigskip
설정 ).\parindent
\parskip
중첩된 표 형식도 의미가 없습니다. 하나의 (간단한) 표이면 충분합니다. 또는 , a 또는 미니페이지 환경 \fbox{}
과 같이 프레임 상자에서 사용하는 공간보다 적은 선 너비를 사용할 수 있는 프레임 상자( )가 섹션 재정의에 있거나 대안으로 사용할 수 있습니다. 또는 상자를 만들지 않고 간단하게 \vrules 및 \hrules를 작성하면 됩니다 .\makebox
\parbox
mdframed
tcolorbox
이 예에서는 다양한 대안 중 5개를 보여줍니다. 당신을 행복하게 만드는 것을 사용하십시오.
\documentclass{article}
% Padding of \fbox{}
\setlength\fboxsep{.5em}
% Some dummy text between solutions, just to see the layout
\def\loreipsum{Lorem ipsum dolor sit amet, consectetur adipiscing
elit. Fusce elit lectus, dapibus eget pellentesque eu, ultricies
vel turpis. Cras quis convallis nibh.}
% for solution 2 only
\makeatletter
\newcommand\fsection{\@startsection{section}{1}{\z@}%
{1em}{1em}{\bfseries\framedbox}}
\makeatother
\newcommand*\framedbox[1]{\noindent%
\fbox{\parbox{\dimexpr\columnwidth-2\fboxsep}{#1}}}
% for solution 5 only
\usepackage{mdframed}
\begin{document}
\loreipsum
% solution 1
\bigskip\hrule
\noindent
\vrule height 12pt depth 6pt width 0.4pt
{ \bfseries Description sommaire}\hfill\vrule
\hrule\bigskip
\loreipsum
% solution 2
\fsection*{Description sommaire}
\loreipsum
% solution 3
\bigskip
\noindent\fbox{\makebox[\dimexpr\linewidth-2\fboxsep-2\fboxrule][l]
{\textbf{Description sommaire}}}\bigskip
\loreipsum
% solution 4
\bigskip
{\renewcommand\arraystretch{1.4}\setlength\tabcolsep{.5em}
\noindent\begin{tabular}%
{|p{\dimexpr\linewidth-2\tabcolsep-2\arrayrulewidth}|}\hline
\textbf{Description sommaire} \\\hline
\end{tabular}}
\bigskip
\loreipsum
% solution 5
\begin{mdframed}
\textbf{Description sommaire}:
\end{mdframed}
\loreipsum
\end{document}