사용자 정의 용어집 스타일: 용어집을 \textwidth만큼 넓게 만듭니다.

사용자 정의 용어집 스타일: 용어집을 \textwidth만큼 넓게 만듭니다.

경고: 이 질문은 다음에 대한 후속 질문입니다.약어 유형이 아닌 항목의 긴 형식(처음 사용과 같은) 항목 표시.

처럼MAFP다른 게시물에서 제안한 것처럼 (필드를 사용하여) 단위 문제를 해결하기 위해 (일부 열 지정자와 함께) 나만의 용어집 스타일을 정의했습니다 user1. 이제 내 정의는 다음과 같습니다( tabx3col첫 번째 용어집에서 사용된 스타일과 tabx4col두 번째 용어집에서 사용된 스타일).

\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}

\newglossarystyle{tabx3col}{%
 % put the glossary in a longtable environment:
 \renewenvironment{theglossary}%
  {\begin{longtable}{L{0.2\textwidth}L{0.6\textwidth}R{0.2\textwidth}}}%
  {\end{longtable}}%
 % Set the table's header:
 \renewcommand*{\glossaryheader}{}%
 % No heading between groups:
  \renewcommand*{\glsgroupheading}[1]{}%
 % Main (level 0) entries displayed in a row:
  \renewcommand*{\glossaryentryfield}[5]{%
    \glstarget{##1}{\textbf{##2}}% Name
    & ##3% Description
    & ##5% Page list
    \\% end of row
  }%
 % Sub entries treated the same as level 0 entries:
 %\renewcommand*{\glossarysubentryfield}[6]{%
  %\glossaryentryfield{##2}{##3}{##5}{##6}}%
 %% Nothing between groups:
 %\renewcommand*{\glsgroupskip}{}%
}


\newglossarystyle{tabx4col}{%
 % put the glossary in a longtable environment:
 \renewenvironment{theglossary}%
  {\begin{longtable}{L{0.1\textwidth}L{0.1\textwidth}p{0.55\textwidth}R{0.2\textwidth}}}%
  {\end{longtable}}%
 % Set the table's header:
 \renewcommand*{\glossaryheader}{}%
 % No heading between groups:
  \renewcommand*{\glsgroupheading}[1]{}%
 % Main (level 0) entries displayed in a row:
  \renewcommand*{\glossaryentryfield}[5]{%
   \glstarget{\textbf{##1}}{\textbf{##2}}% Name
   & $[$\glsentryuseri{##1}$]$% Units
   & ##3% Description
   & ##5% Page list
    \\% end of row
  }%
 % Sub entries treated the same as level 0 entries:
 %\renewcommand*{\glossarysubentryfield}[6]{%
  %\glossaryentryfield{##2}{##3}{##5}{##6}}%
 %% Nothing between groups:
 %\renewcommand*{\glsgroupskip}{}%
}

그러면 아래 이미지와 같은 출력이 제공됩니다. 출력 스크린샷

정렬하려는 텍스트에 대한 회색 선이 있는 스크린샷을 편집합니다( R페이지 목록에 사용되는 고정 너비 비정형 열에 대한 열 지정자 사용). 주로 용어집 전체를 갖고 싶습니다 \textwidth. 나는 모든 열을 \textwidth변수에 종속시키고 최대 1의 값을 추가함으로써 궁극적으로 헤더라인만큼 넓은 테이블을 얻을 것이라고 생각했습니다 . 또한 테이블 환경으로 tabularx를 사용해 보았으나 실패했습니다(예: 매크로 명령을 사용하더라도 \tabularx \endtabularx ). 나는 MWE(http://pastebin.com/McqsTPga, 더 이상 그렇게 작지 않을 수도 있음) 문제를 직접 확인할 수 있습니다.

글이 다소 길어져서 죄송합니다만, 정말 짜증스럽습니다.

답변1

\textwidth"모든 열을 변수에 종속시키고 값을 최대 1까지 추가하면 궁극적으로 헤더 라인만큼 넓은 테이블을 얻을 수 있다고 생각했습니다 ." 거의 맞는 말인데 자동으로 추가되는 열간 공백을 잊어버리셨군요. @{}열 사양을 사용 하여 이를 억제할 수 있습니다 . 내가 테이블을 지정할 때

\newglossarystyle{tabx3col}{%
 \renewenvironment{theglossary}%
  {\begin{longtable}{@{}p{0.2\textwidth}@{}p{0.6\textwidth}@{}>{\raggedleft}p{0.2\textwidth}@{}}}%
  ...

그리고

\newglossarystyle{tabx4col}{%
 \renewenvironment{theglossary}%
  {\begin{longtable}{@{}p{0.12\textwidth}@{}p{0.08\textwidth}@{}p{0.6\textwidth}@{}>{\raggedleft}p{0.2\textwidth}@{}}}%
  ...

원하는대로 정렬이 나옵니다. 설명 전후에 열 사이의 공간을 억제하지 않는 것이 더 좋을 수도 있습니다. 그런 다음 설명 열(또는 다른 열)을 24pt만큼 좁혀야 합니다.

답변2

다음과 같이 정렬을 \usepackage{calc}지정할 수 있습니다 .longtable

\begin{longtable}{
  @{} % suppress the space at the left
  L{0.1\textwidth-\tabcolsep}
  L{0.1\textwidth-2\tabcolsep}
  p{0.6\textwidth-2\tabcolsep}
  R{0.2\textwidth-\tabcolsep}
  @{} % suppress the space at the right
}

가장 넓은 열에서 열 사이의 공백을 제거할 수 있습니다. 이 경우

\begin{longtable}{
  @{} % suppress the space at the left
  L{0.1\textwidth}
  L{0.1\textwidth}
  p{0.6\textwidth-6\tabcolsep}
  R{0.2\textwidth}
  @{} % suppress the space at the right
}

각 열의 앞과 뒤에는 \tabcolsep넓은 공백이 있습니다. 4개의 열이 있으므로 가장 왼쪽과 오른쪽 공백을 억제한 후 그 중 6개가 남습니다.

관련 정보