한 줄의 아래쪽과 다음 줄의 위쪽 사이의 공백을 완전히 제거하는 방법

한 줄의 아래쪽과 다음 줄의 위쪽 사이의 공백을 완전히 제거하는 방법

줄 간격을 0으로 설정하려고 해도 줄 사이에 약간의 공간이 있습니다. 원인은 무엇이며 이 공간을 0으로 설정하려면 어떻게 해야 합니까?

\documentclass{article}
\usepackage{anyfontsize}

\setlength{\fboxsep}{0cm}  % So that we can see the exact box around some text
\setlength{\fboxrule}{0.1pt}  % Hairline box

\begin{document}

\noindent{\fontsize{1cm}{1cm}\selectfont \fbox{Foo}\\\fbox{Bar}}

\end{document}

줄 사이의 공간

답변1

0으로 설정해야 \lineskip하지만 `cm의 기준선 건너뛰기를 지정했지만 상자가 그보다 작습니다.

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

\documentclass{article}
\usepackage{anyfontsize}



\setlength{\fboxsep}{0cm}  % So that we can see the exact box around some text
\setlength{\fboxrule}{0.1pt}  % Hairline box

\begin{document}
\setlength\lineskip{0pt}
\fontsize{1cm}{.7cm}\selectfont 

\noindent\fbox{Foo}\\\fbox{Bar}


\bigskip

\noindent\fbox{\strut Foo}\\\fbox{\strut Bar}

\end{document}

답변2

설정 \setlength\lineskip{0pt}(다음과 같이데이비드의 대답) 여전히 작은 간격이 남아 있었지만 \nointerlineskip(내 질문에 대한 Barbara의 의견에서와 같이) 간격이 완전히 제거되었습니다.

다음을 사용한 실제 예제 \nointerlineskip:

\documentclass{article}
\usepackage{anyfontsize}

\setlength{\fboxsep}{0cm}  % So that we can see the exact box around some text
\setlength{\fboxrule}{0.1pt}  % Hairline box

\begin{document}
    \fontsize{1cm}{0.7cm}\selectfont 

    \noindent\fbox{One} \par \nointerlineskip \noindent\fbox{Two}

    % Or use whitespace instead of par:

    \noindent\fbox{Three} 

    \nointerlineskip
    \noindent\fbox{Four}
\end{document}

결과(확대):

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

\offinterlineskip문서 섹션 시작 부분에 서문을 넣어서 행 간 건너뛰기를 전역적으로 설정할 수도 있습니다 .

줄 바꿈을 만드는 데 \nointerlineskip사용할 때는 작동하지 않는다는 점도 주목할 가치가 있습니다 . \\예를 들어 foo \\ \nointerlineskip bar오류가 발생합니다.

관련 정보