유용한 패키지 정리 - Preamble과 본문
1. 기본 사항
\documentclass[14pt]{extarticle}
%많은 class중 article 을 불러옴
%article book report amsart amsbook memoir oblivoir 등이 있음. 문서의 형식을 정함.
%article은 \chapter 명령어가 없는 글이고, book은 있다.
\usepackage[a4paper]{geometry}
% 종이크기 정하는 패키지
\geometry{legalpaper, portrait, margin=3em}
% 종이의 방향과 여백을 조정
\usepackage[english]{babel}
%영국식 양식 - 날짜 출력 형식을 조정
\hbadness=99999 % or any number >=10000
\vbadness=99999 % or any number >=10000
\hfuzz=20pt
이게 있어야 hbadness와 관련된 에러 메시지를 피할 수 있다고 한다.
에러 메시지가 떠도 pdf가 잘 만들어지지만 Console Output에 시간이 너무 오래 걸려서 이걸 넣었다.
https://young-square.tistory.com/62
[LaTeX][에러 해결] Package hyperref Warning:~~~, Underfull \hbox ~~~, Overfull \hbox ~~~
본 글에서 활용한 환경은 overleaf 웹사이트이며, https://www.overleaf.com/ Overleaf, Online LaTeX Editor An online LaTeX editor that’s easy to use. No installation, real-time collaboration, version control, hundreds of LaTeX templates, and
young-square.tistory.com
\makeatletter
...
\makeatother
https://tex.stackexchange.com/questions/8351/what-do-makeatletter-and-makeatother-do
What do \makeatletter and \makeatother do?
Many LaTeX “hacks” begin with \makeatletter and end with \makeatother. What do these commands do?
tex.stackexchange.com
설명을 보니 @을 11에서 12로 바꾼다는데 잘 모르겠다. 시스템적인 설정인듯. Preamble에 @가 들어가야 하는 코드가 있을 때, 그 코드 앞뒤로 이 조합을 적어주면 되는 것 같다.
2. 문자 출력 관련
\usepackage{fontspec}
% 그리스어 폰트(Libertinus Serif) 가능
\usepackage[T1]{fontenc}
% 한중일 폰트 설정하기 위해 필요한 패키지
\usepackage{xeCJK}
% 한중일어 사용하기 위한 패키지
\xeCJKsetup{CJKspace=true}
%띄어쓰기 사용. 중국어, 일어는 필요 없을수도, math environment 안에서 CJK 글자 사용
%CJKspace={} : Western과 CJK 사이의 공백 지정: {}로 간격을 없앰
\setCJKmainfont[Scale=0.8]{Noto Serif KR}
\setCJKsansfont{Noto Sans KR}
%\setCJKmonofont{Noto Sans Mono CJK KR}
%CJK 폰트 설정
\setmainfont{Linux Libertine}
문서 메인 폰트 설정
\usepackage[T1]{fontenc}
% 한중일 폰트 설정하기 위해 필요한 패키지
%\usepackage{kotex,graphicx}
한글을 출력하고 싶을 때 간단하게 이것만을 써도 된다.
3. expex를 통한 Gloss
\usepackage{realscripts}
%이것이 있어야 expex gloss의 각주가 달림.
\usepackage{expex}
%글로싱 위한 것
\renewcommand\footnotesize{%
\@setfontsize\footnotesize\@xiipt{12}%
\abovedisplayskip 8\p@ \@plus2\p@ \@minus4\p@
\abovedisplayshortskip \z@ \@plus\p@
\belowdisplayshortskip 4\p@ \@plus2\p@ \@minus2\p@
\def\@listi{\leftmargin\leftmargini
\topsep 4\p@ \@plus2\p@ \@minus2\p@
\parsep 2\p@ \@plus\p@ \@minus\p@
\itemsep \parsep}%
\belowdisplayskip \abovedisplayskip
}
\def\makefootnotehacks#1{\begingroup
\XKV@for@n{#1}\which{%
\edef\temp{fnhack\which}%
\advance\c@footnote by 1
\expandafter\xdef\csname \temp\endcsname
{\hskip.1em \textsuperscript{\the\c@footnote}}}\endgroup\ignorespaces}%
\def\footnotehacktext{\advance\c@footnote by 1 \footnotetext}
%이 묶음은 expex gloss 각주를 위한 코드이니 변형하지 말 것.
\lingset{
everygla=\fontsize{14}{14}\itshape, extraglskip=2.5ex, glbcolor=blue, glccolor=red, glbreaking
}
글로싱의 모양 설정
4. 목차
% we use \prefix@<level> only if it is defined
\renewcommand{\@seccntformat}[1]{%
\ifcsname prefix@#1\endcsname
\csname prefix@#1\endcsname
\else
\csname the#1\endcsname\quad
\fi}
% define \prefix@section
\newcommand\prefix@section{}
\newcommand\prefix@subsection{}
\newcommand\prefix@subsubsection{}
\renewcommand{\thesubsection}{\arabic{subsection}} %section 자동 번호매김 방지 코드
\setcounter{secnumdepth}{0}
% sections are level 1 %section에 0.x가 뜨는 것을 방지
\setcounter{tocdepth}{2}
%TOC에 \section 위계까지만 보이게 설정
5. 글 모양
\usepackage{setspace}
%줄간격 조정을 위한 명령어. 전체 줄간격을 늘이거나 줄일 때 이 명령을 아래의 것과 같이 쓴다.
\setstretch{1.1}
\usepackage{paracol}
단을 설정하는 패키지
6. 표
\usepackage[table, xcdraw, dvipsnames]{xcolor}
색상을 입힐 수 있는 패키지
https://en.wikibooks.org/wiki/LaTeX/Colors
LaTeX/Colors - Wikibooks, open books for an open world
From Wikibooks, open books for an open world Adding colors to your text is supported by the xcolor package (supersedes package color). Using this package, you can set the font color, text background, or page background. You can choose from predefined color
en.wikibooks.org
dvipsnames의 제공 색상을 정리해둔 곳
\definecolor{Myyellow}{HTML}{fffe65}
%색상을 사용자 지정할 수 있음
\usepackage{longtable}
%페이지를 넘어가는 테이블을 만들 때 사용. 본인은 longtable에서 tabularray의 longtblr로 갈아탐.
\usepackage{tabularray}
\DefTblrTemplate{firsthead, middlehead,lasthead}{default}{}
%longtblr의 caption 삭제
\usepackage[skip=0.333\baselineskip]{caption}
기억안남
https://www.tablesgenerator.com/latex_tables#
Create LaTeX tables online – TablesGenerator.com
You can import table data by uploading file in CSV format (Comma Separated Value). Most spreadsheet software, both desktop and online, allows to save tabular data in CSV format — it is usually available in the File menu under the name "Save As..." or "Ex
www.tablesgenerator.com
테이블을 만들어주는 사이트. longtblr이 아니라 longtable이 출력되어 매번 바꿔줘야 하는 불편함이 있다.
표와 관한 상세 설명은 아래 나의 블로그 글을 참고하시라. 물론 그 전에 preamble에 위 코드들이 먼저 들어 있어야 한다.
https://dsblog.tistory.com/entry/Latex%EC%9C%BC%EB%A1%9C-
%ED%91%9C%ED%85%8C%EC%9D%B4%EB%B8%94-%EB%A7%8C%EB%93%A4%EA%B8%B0#toc4
Latex으로 표(테이블) 만들기
1. 사이트 이용https://www.tablesgenerator.com/latex_tables# 예시로 입력하였다. Generate를 누르면 표 코드를 출력해준다. 옵션을 잘 보시길. multiple pages는 설정하는 게 좋다. 왜냐하면 저걸 빼니 표가 페이
dsblog.tistory.com
7. 기타
\usepackage{comment}
주석을 범위지정으로 넣을 수 있게 하는 패키지.
\usepackage{enumitem}
불렛(숫자) 리스트를 만들 때 사용
\setenumerate{noitemsep}
% sets no itemsep for enumerate lists only
리스트 간격 삭제(잘 작동되지 않았던 것 같음.)
반드시
\begin{enumitem}
\item
\end{enumitem}
이 형식으로 적어야 함(\item을 빼놓아서 오류가 나는 경우 많음.)
\usepackage{datetime}
\newdate{date}{20}{09}{2023}
\date{\displaydate{date}}
날짜를 출력하는 코드. bable 코드로 형식을 설정할 수 있음
8. 본문에서 사용할 수 있는 코드
\excnt=1
%자동 번호 매기기가 오작동할 때, 혹은 다시 1부터 출력하도록 만들고 싶을 때 사용
\defineglwlevels{gloss 이름}
expex에서 gla, glb, glc 이외에도 더 많은 gloss를 입력하고 싶을 때 사용.
물론 glabc중에서 골라서 몇 번 더 써도 되지만 이렇게 이름을 정해주면 서식을 정해줄 수 있다.
https://tex.stackexchange.com/questions/156066/align-glosses-in-more-than-one-language-with-gb4e
Align glosses in more than one language with gb4e
I'm using the package gb4e to gloss my linguistic examples. It nicely aligns the words in the original language with its glosses. But this alignment does not extend beyond the first line of glosses...
tex.stackexchange.com