[LaTeX] Linewidth, Textwidth 등 길이 차이

2022. 12. 13. 19:24·기타/논문작성 Writing

레이텍을 쓰다보면 textwidth를 쓰는 게 맞는 건지, linewidth를 쓰는게 맞는 건지 헷갈리는 때가 있다.

이에 대한 차이를 검색해서 다른 사람들이 쓴 의견을 정리해놓는다.

 

 

1. \hsize, \textwidth, \columnwidth, \linewidth에 대한 구별

 

  • \hsize is a TeX primitive that should not be usually used in LaTeX
  • \textwidth is the (constant) width of the total text block
  • \columnwidth is the (constant) width of a single column of text
    (which is the same as \textwidth for a single column document)
  • \linewidth is a variable that represents the current size of the line of text, whether inside a column or a minipage or a list

hsize는 잘 쓰지 않는 옛날 값이다.(나 역시 한 번도 써본 적이 없다.)

textwidht는 text block의 width라고 한다.

columnwidth는 한 페이지에 컬럼이 여러 개 있을 때 한 column의 너비를 말한다. 만약 one column인 텍스트라면 textwidth와 columnwidth는 일치한다.

 

linewidth는 유동적인 값으로, latex 안에서 다른 블록이나 미니페이지, 컬럼으로 들어갈 때 현재 상태에서의 linewidth를 말한다.

 

이를 코드로서 구별되도록 다른 분이 답변을 남겨놓으셨다.

 

\documentclass[twocolumn]{article}
\parindent=0pt
\usepackage[paperheight=7cm]{geometry}
\begin{document}

\leavevmode\rlap{text:}\rule{\textwidth}{2pt}\par
\leavevmode\rlap{line:}\rule{\linewidth}{2pt}\par
\leavevmode\rlap{hsize:}\rule{\hsize}{2pt}\par
\leavevmode\rlap{column:}\rule{\columnwidth}{2pt}

\begin{itemize}
\item \rule{\textwidth}{5pt}
\item \rule{\linewidth}{5pt}
\item \rule{\hsize}{5pt}
\item \rule{\columnwidth}{5pt}
\end{itemize}

\onecolumn
\leavevmode\rlap{text:}\rule{\textwidth}{2pt}\par
\leavevmode\rlap{line:}\rule{\linewidth}{2pt}\par
\leavevmode\rlap{hsize:}\rule{\hsize}{2pt}\par
\leavevmode\rlap{column:}\rule{\columnwidth}{2pt}

\begin{itemize}
\item \rule{\textwidth}{5pt}
\item \rule{\linewidth}{5pt}
\item \rule{\hsize}{5pt}
\item \rule{\columnwidth}{5pt}
\end{itemize}

\end{document}

 

 

위 그림을 보면 1페이지는 two column인 경우이고, 아래는 one column인 경우이다.

 

첫번째 페이지에서 \textwidth는 컬럼 개수에 관계없이 페이지의 너비를 의미하며 고정된 값이다.

반면에 \columnwidth,\linewidth, \hsize는 모두 컬럼에 맞춰진다.

그러나 만약 특정 구간(위의 경우에는 itemize 구간) 안에 들어가면 linewidth는 itemize로 인해 들여쓰기 된 것까지 감안하여 linewidth가 작성된다. 그러나 나머지 \columnwidth, \hsize는 constant값으로 유지된다.

 

2페이지에서도 총 페이지가 하나의 컬럼인데 \linewidth의 경우에는 줄 들여쓰기에 맞춰져 길이가 변한다.

즉, figure size를 정할 때 유동적으로 줄의 길이에 따라 비율로 쓰고 싶으면 \linewidth로 쓰는 거고, 고정된 textwidth에 따라 쓰고 싶으면 \textwidth를 쓰면 된다.

 


참고 글

 

https://tex.stackexchange.com/questions/16942/difference-between-textwidth-linewidth-and-hsize

 

Difference between \textwidth, \linewidth and \hsize

The three lengths \textwidth, \linewidth and \hsize seem to all hold the width of the current line. At least I never saw some real difference between \textwidth and \linewidth in my code. Both seem...

tex.stackexchange.com

 

 

저작자표시 비영리 변경금지 (새창열림)

'기타 > 논문작성 Writing' 카테고리의 다른 글

[LaTeX] 캡션 정렬 방법  (0) 2023.01.23
[논문작성] 논문에서 영문이름에 대하여  (0) 2023.01.18
[LaTeX] LaTeX 글 첫 문단에서 들여쓰기 & 문단 사이 간격 조절  (0) 2022.12.02
[LaTeX] Table이 linewidth보다 클 때 사이즈 조절하는 법  (0) 2022.11.27
[MathType] 한글에서 MathType 사용하는 방법  (0) 2022.10.20
'기타/논문작성 Writing' 카테고리의 다른 글
  • [LaTeX] 캡션 정렬 방법
  • [논문작성] 논문에서 영문이름에 대하여
  • [LaTeX] LaTeX 글 첫 문단에서 들여쓰기 & 문단 사이 간격 조절
  • [LaTeX] Table이 linewidth보다 클 때 사이즈 조절하는 법
보통의공대생
보통의공대생
수학,프로그래밍,기계항공우주 등 공부하는 기록들을 남깁니다.
  • 보통의공대생
    뛰는 놈 위에 나는 공대생
    보통의공대생
  • 전체
    오늘
    어제
    • 분류 전체보기 (460) N
      • 공지 (1)
      • 영어 공부 English Study (40)
        • 텝스 TEPS (7)
        • 글 Article (21)
        • 영상 Video (10)
      • 연구 Research (99)
        • 최적화 Optimization (3)
        • 데이터과학 Data Science (7)
        • 인공지능 Artificial Intelligent (40)
        • 제어 Control (45)
      • 프로그래밍 Programming (103)
        • 매트랩 MATLAB (25)
        • 파이썬 Python (33)
        • 줄리아 Julia (2)
        • C++ (3)
        • 리눅스 우분투 Ubuntu (6)
      • 항공우주 Aeronautical engineeri.. (21)
        • 항법 Navigation (0)
        • 유도 Guidance (0)
      • 기계공학 Mechanical engineering (13)
        • 열역학 Thermodynamics (0)
        • 고체역학 Statics & Solid mechan.. (10)
        • 동역학 Dynamics (1)
        • 유체역학 Fluid Dynamics (0)
      • 수학 Mathematics (34)
        • 선형대수학 Linear Algebra (18)
        • 미분방정식 Differential Equation (3)
        • 확률및통계 Probability & Sta.. (2)
        • 미적분학 Calculus (1)
        • 복소해석학 Complex Analysis (5)
        • 실해석학 Real Analysis (0)
      • 수치해석 Numerical Analysis (21)
      • 확률 및 랜덤프로세스 Random process (2)
      • 추론 & 추정 이론 Estimation (3)
      • 기타 (26)
        • 설계 프로젝트 System Design (8)
        • 논문작성 Writing (55)
        • 세미나 Seminar (2)
        • 생산성 Productivity (3)
      • 유학 생활 Daily (7) N
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    우분투
    pytorch
    LaTeX
    MATLAB
    Julia
    WOX
    텝스
    논문작성
    서버
    생산성
    Statics
    matplotlib
    논문작성법
    수치해석
    Numerical Analysis
    텝스공부
    Linear algebra
    인공지능
    Dear abby
    Zotero
    에러기록
    JAX
    obsidian
    IEEE
    고체역학
    옵시디언
    Python
    teps
    딥러닝
    ChatGPT
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.3
보통의공대생
[LaTeX] Linewidth, Textwidth 등 길이 차이
상단으로

티스토리툴바