
내가 이해하는 한(틀렸다면 정정), tufte 클래스의 단점은 보조 노트가 페이지 나누기를 넘을 수 없다는 것입니다. 사이드 노트는 시작하는 페이지에서 끝나야 합니다.
나는 KOMA-Script의 최신 버전에 scrlayer-notecolumn
이 문제를 해결하는 패키지가 포함되어 있다는 것을 깨달았습니다. 페이지 나누기와 별도로 보조 노트를 가질 수 있습니다.
사이드 노트는 플로트 내부에서도 작동하지만 사이드 노트의 번호 매기기가 문제입니다.
여백에 표와 그림이 있을 수 있지만 여백의 각 명령에는 \protect
.
margintabular
질문: tufte 클래스와 같은 환경을 작성하는 방법은 무엇입니까 ? 패키지로 Tufte 스타일 문서를 개선하려면 무엇이 더 필요합니까 scrlayer-notecolumn
?
\documentclass{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{scrlayer-scrpage, scrlayer-notecolumn, lmodern, blindtext,
ragged2e}
%% step 1: counter
\newcounter{snmark}
\setcounter{snmark}{0}
%% step 2: hanging sidenotes, definition from tugboat
\makeatletter
\newcommand*{\hangfrom}[1]{%
\setbox\@tempboxa\hbox{{#1}}%
\hangindent \wd\@tempboxa
\noindent\box\@tempboxa}
\makeatletter
%% step 3: define sidenote marks in the text
\newcommand{\makesidenotemark}{%
\textsuperscript{\thesnmark}
}%
%% step 4: and now the definition of sidenotes
\newcommand{\sidenote}[1]{%
\refstepcounter{snmark}% Zähler erhöhen
\makesidenotemark{}% Nummer im Text setzen.
\makenote[paragraphs]{%
\hangfrom{%
\makebox[1em][l]{%
\thesnmark}
}
\protect\RaggedRight{} #1}% Text setzen im Rand
}
%% this is, except for the values (».7«) from scrguide.pdf to define
%% the notecolumn.
\newlength{\paragraphscolwidth}
\AfterCalculatingTypearea{%
\setlength{\paragraphscolwidth}{.4\textwidth}%
\addtolength{\paragraphscolwidth}{-\marginparsep}%
}
\recalctypearea
\DeclareNewNoteColumn[%
position=\oddsidemargin+1in
+.7\textwidth
+\marginparsep,
width=\paragraphscolwidth,
font=\footnotesize
]{paragraphs}
%% Delete all sidenotes:
%\renewcommand{\sidenote}[1]{\relax}
\begin{document}
\begin{addmargin}[0pt]{.3\textwidth}
This is the text with a \sidenote{See here.\blindtext}.
\blindtext
And here we have a second paragraph and a second
sidenote\sidenote{\blindtext}.
\blindtext
And this is the big hit: We can have sidenotes which include
pagebreaks!\sidenote{Proof of concept: \blindtext{}}
\syncwithnotecolumns[paragraphs]
And now we somewhere have a table:
\begin{table}[b]
\centering
\begin{tabular}{ll}
Proof\sidenote{From inside the float} & of concept\\
\end{tabular}
\caption{This is a table}
\label{tab:table}
\end{table}
Besides that, we even can have tabulars in the margin\sidenote{%
Tabular in the margin:
\protect\begin{tabular}{|l|l|}\protect\hline
a& b\\\protect\hline
a& b\\\protect\hline
a& b\\\protect\hline
\protect\end{tabular}
}, but they have
to be narrow and well protected.
\end{addmargin}
\end{document}
답변1
여백 메모 내부에 표를 포함하려면 일종의 부동 표 환경을 만들 수 있습니다.
\usepackage{environ}
\makeatletter
\NewEnviron{margintable}{%
\expandafter\@margintable\expandafter{\BODY}%
}
\newcommand*\@margintable[1]{%
\makenote[paragraphs]{%
\protect\begin{nonfloattable}\detokenize{#1}\protect\end{nonfloattable}
}%
}
\newenvironment{nonfloattable}{%
\par\noindent\begin{minipage}{\linewidth}
\def\@captype{table}%
}{%
\end{minipage}\par
}
aux
하지만 문제가 있습니다. 노트 내에서 -file 에 레이블을 쓰는 것이 작동하지 않는 것 같아서 환경 \label{tab:secondtable}
내부에서는 margintable
레이블이 생성되지 않습니다.
이상한 점: 파일에 캡션을 쓰는 것이 aux
작동합니다.
aux
현재 파일에 레이블을 쓰는 것이 작동하지 않는 이유를 모르지만 파일 lot
에 항목을 쓰는 aux
것은 작동합니다. 그럼에도 불구하고 메모를 작성할 때 대신 aux
사용할 때 해킹을 사용하여 -file에 레이블 정보를 쓸 수 있습니다 .margintable
\documentclass{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{scrlayer-scrpage, scrlayer-notecolumn, lmodern, blindtext,
ragged2e}
%% step 1: counter
\newcounter{snmark}
\setcounter{snmark}{0}
%% step 2: hanging sidenotes, definition from tugboat
\makeatletter
\newcommand*{\hangfrom}[1]{%
\setbox\@tempboxa\hbox{{#1}}%
\hangindent \wd\@tempboxa
\noindent\box\@tempboxa}
\makeatletter
%% step 3: define sidenote marks in the text
\newcommand{\makesidenotemark}{%
\textsuperscript{\thesnmark}
}%
%% step 4: and now the definition of sidenotes
\newcommand{\sidenote}[1]{%
\refstepcounter{snmark}% Zähler erhöhen
\makesidenotemark{}% Nummer im Text setzen.
\makenote[paragraphs]{%
\hangfrom{%
\makebox[1em][l]{%
\thesnmark}
}
\protect\RaggedRight{} #1}% Text setzen im Rand
}
%% this is, except for the values (».7«) from scrguide.pdf to define
%% the notecolumn.
\newlength{\paragraphscolwidth}
\AfterCalculatingTypearea{%
\setlength{\paragraphscolwidth}{.4\textwidth}%
\addtolength{\paragraphscolwidth}{-\marginparsep}%
}
\recalctypearea
\DeclareNewNoteColumn[%
position=\oddsidemargin+1in
+.7\textwidth
+\marginparsep,
width=\paragraphscolwidth,
font=\footnotesize
]{paragraphs}
\usepackage{environ}
\makeatletter
\NewEnviron{margintable}{%
\expandafter\@margintable\expandafter{\BODY}%
}
\newcommand*\@margintable[1]{%
\global\let\labeltoset\@empty
\@tempcnta\value{table}%
\begin{lrbox}{\@tempboxa}
\begin{minipage}{\paragraphscolwidth}
\def\label##1{%
\xdef\labeltoset{%
\labeltoset
\noexpand\protected@write\noexpand\@auxout{}{%
\noexpand\string\noexpand\newlabel{##1}{{\@currentlabel}{\thepage}}}%
}%
}%
\def\@captype{table}%
#1%
\end{minipage}
\end{lrbox}%
\setcounter{table}{\@tempcnta}%
\makenote[paragraphs]{%
\protect\begin{nonfloattable}\detokenize{#1}\protect\end{nonfloattable}
}%
\labeltoset
}
\newenvironment{nonfloattable}{%
\par\noindent\begin{minipage}{\linewidth}
\def\@captype{table}%
}{%
\end{minipage}\par
}
%% Delete all sidenotes:
%\renewcommand{\sidenote}[1]{\relax}
\begin{document}
\begin{addmargin}[0pt]{.3\textwidth}
This is the text with a \sidenote{See here.\blindtext}.
\blindtext
And here we have a second paragraph and a second
sidenote\sidenote{\blindtext}.
\blindtext
And this is the big hit: We can have sidenotes which include
pagebreaks!\sidenote{Proof of concept: \blindtext{}}
\syncwithnotecolumns[paragraphs]
And now we somewhere have a table:
\begin{table}[b]
\centering
\begin{tabular}{ll}
Proof\sidenote{From inside the float} & of concept\\
\end{tabular}
\caption{This is a table}
\label{tab:table}
\end{table}
Besides that, we even can have tabulars in the margin\sidenote{%
Tabular in the margin:
\protect\begin{tabular}{|l|l|}\protect\hline
a& b\\\protect\hline
a& b\\\protect\hline
a& b\\\protect\hline
\protect\end{tabular}
}, but they have
to be narrow and well protected.
\begin{margintable}
\centering
\begin{tabular}{|l|l|}\hline
a& b\\\hline
a& b\\\hline
a& b\\\hline
\end{tabular}
\caption{This is a second table}%
\label{tab:secondtable}
\end{margintable}
See also table~\ref{tab:secondtable}.
\end{addmargin}
\listoftables
\end{document}
하지만 여전히 문제가 있습니다. 메모가 다른 페이지로 이동하면 라벨의 페이지 번호가 잘못됩니다.
업데이트: scrlayer-notecolumn
0.1.2583 부터KOMA 스크립트 3.23.2583 \label
메모에서는 예상대로 작동합니다. 그리고 새로운 제품을 사용하면 더 이상 \makenote*
이러한 모든 것이 필요하지 않습니다 . \protect
따라서 다음이 작동합니다.
\documentclass{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{scrlayer-scrpage, scrlayer-notecolumn, lmodern, blindtext,
ragged2e}
%% step 1: counter
\newcounter{snmark}
\setcounter{snmark}{0}
%% step 2: hanging sidenotes, definition from tugboat
\makeatletter
\newcommand*{\hangfrom}[1]{%
\setbox\@tempboxa\hbox{{#1}}%
\hangindent \wd\@tempboxa
\noindent\box\@tempboxa}
\makeatletter
%% step 3: define sidenote marks in the text
\newcommand{\makesidenotemark}{%
\textsuperscript{\thesnmark}%
}%
%% step 4: and now the definition of sidenotes
\newcommand{\sidenote}[1]{%
\refstepcounter{snmark}% Zähler erhöhen
\makesidenotemark{}% Nummer im Text setzen.
\makenote[paragraphs]{%
\hangfrom{%
\makebox[1em][l]{%
\thesnmark}%
}%
\protect\RaggedRight\detokenize{#1}}% Text setzen im Rand
}
%% this is, except for the values (».7«) from scrguide.pdf to define
%% the notecolumn.
\newlength{\paragraphscolwidth}
\AfterCalculatingTypearea{%
\setlength{\paragraphscolwidth}{.4\textwidth}%
\addtolength{\paragraphscolwidth}{-\marginparsep}%
}
\recalctypearea
\DeclareNewNoteColumn[%
position=\oddsidemargin+1in
+.7\textwidth
+\marginparsep,
width=\paragraphscolwidth,
font=\footnotesize
]{paragraphs}
\usepackage{environ}
\makeatletter
\NewEnviron{margintable}{%
\expandafter\@margintable\expandafter{\BODY}%
}
\newcommand*\@margintable[1]{%
\makenote*[paragraphs]{%
\begin{nonfloattable}#1\end{nonfloattable}%
}%
}
\newenvironment{nonfloattable}{%
\par\noindent\begin{minipage}{\linewidth}
\def\@captype{table}%
}{%
\end{minipage}\par
}
\usepackage{makeidx}
%% Delete all sidenotes:
%\renewcommand{\sidenote}[1]{\relax}
\begin{document}
\begin{addmargin}[0pt]{.3\textwidth}
This is the text with a sidenote\sidenote{See here.\blindtext}.
\blindtext
And here we have a second paragraph and a second
sidenote\sidenote{\blindtext}.
\blindtext
And this is the big hit: We can have sidenotes which include
pagebreaks!\sidenote{Proof of concept: \blindtext{}}
\syncwithnotecolumns[paragraphs]
And now we somewhere have a table:
\begin{table}[b]
\centering
\begin{tabular}{ll}
Proof\sidenote{From inside the float} & of concept\\
\end{tabular}
\caption{This is a table}
\label{tab:table}
\end{table}
Besides that, we even can have tabulars in the margin\sidenote{%
Tabular in the margin:
\begin{tabular}{|l|l|}\hline
a& b\\\hline
a& b\\\hline
a& b\\\hline
\end{tabular}%
}, but they have
to be narrow and well protected.
\begin{margintable}
\centering
\begin{tabular}{|l|l|}\hline
a& b\\\hline
a& b\\\hline
a& b\\\hline
\end{tabular}
\caption{This is a second table}%
\label{tab:secondtable}
\end{margintable}
See also table~\ref{tab:secondtable}.
\listoftables
\end{addmargin}
\end{document}
즉시 확장이 필요하기 때문에 사용할 \sidenote
수 없습니다 . 하지만 위의 예에서 볼 수 있듯이 자신 만의 트릭을 사용할 수 있습니다 .\makenote*
\thesnmark
\detokenize
\makenote*
참고: 위 코드에서는 몇 가지 공백 오류를 수정했습니다.