很棒多色包。问题是 - 如何正确地做\列中断让元素对齐?
换句话说:
- 任何元素类型——段落、图像、表格
- 后\列中断命令必须创建新列
- 第二列中的其余元素与第一列中的第一个元素对齐
与tufte风格类似,但布局应严格形式化。
有人可以帮忙实现这种行为吗?
例如,在多色打包后的图片\列中断没有与第一列对齐。
答案1
正如我在评论中所写,我猜测垂直偏移是由中心环境引起的。
为了好玩,我尝试重新使用我以前的帖子,关于拥有一个带有边注的双列文档,这些边注可以跨越分页符。为此,我不得不将您的 tikzpicture 外部化并单独编译它。代码:
\documentclass{standalone}
\usepackage{tikz, adjustbox}
\graphicspath{ { . } }
\usetikzlibrary{matrix}
\begin{document}
% \begin{adjustbox}{width=10cm}
\begin{tikzpicture}
\matrix (m) [matrix of math nodes, row sep=3em,
column sep=3em]{
& f^\ast E_V& & \vphantom{f^\ast}E_V \\
f^\ast E & & \vphantom{f^\ast}E & \\
& U & & V \\
M & & N & \\};
\path[-stealth]
(m-1-2) edge (m-1-4) edge (m-2-1)
edge [densely dotted] (m-3-2)
(m-1-4) edge (m-3-4) edge (m-2-3)
(m-2-1) edge [-,line width=6pt,draw=white] (m-2-3)
edge (m-2-3) edge (m-4-1)
(m-3-2) edge [densely dotted] (m-3-4)
edge [densely dotted] (m-4-1)
(m-4-1) edge (m-4-3)
(m-3-4) edge (m-4-3)
(m-2-3) edge [-,line width=6pt,draw=white] (m-4-3)
edge (m-4-3);
\end{tikzpicture}
% \end{adjustbox}}
\end{document}
好的,那么让我们看看主文件:
\documentclass[parskip=full]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{scrlayer-scrpage, scrlayer-notecolumn, lmodern, blindtext,
ragged2e, graphicx, booktabs}
%% 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}[2]{%
\refstepcounter{snmark}% Zähler erhöhen
%\makesidenotemark{}% Nummer im Text setzen.
\makenote[paragraphs]{%
\protect\Centering\detokenize{#1}\\
\hangfrom{\textbf{Caption:~}} {#2}}% 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]{.4\textwidth}
lorem ipsum dolor sit
amet\sidenote{\includegraphics[width=\paragraphscolwidth]{cat.jpg}}{A Whatever}, consectetur
adipiscing elit. in eu fermentum mi, vel sagittis dolor. aenean nec leo sed justo
varius egestas non nec lacus. fusce tortor nibh, porttitor a vestibulum sed,
gravida eu nunc. aliquam tempor congue ipsum, eget vestibulum tortor volutpat
dictum. phasellus rutrum justo at diam venenatis, sed porttitor risus
pulvinar. in sit amet enim eros. donec semper vel justo ac lobortis. in hac
habitasse platea dictumst.
lorem ipsum dolor sit amet\sidenote{%
\begin{tabular}{@{}llr@{}} \toprule
\multicolumn{2}{c}{Item} \\ \cmidrule(r){1-2}
Animal & Description & Price (\$)\\ \midrule
Gnat & per gram & 13.65 \\
& each & 0.01 \\
Gnu & stuffed & 92.50 \\
Emu & stuffed & 33.33 \\
Armadillo & frozen & 8.99 \\ \bottomrule
\end{tabular}
}{A tabular}, consectetur adipiscing elit. in eu fermentum mi, vel
sagittis dolor. aenean nec leo sed justo varius egestas non nec lacus. fusce
tortor nibh, porttitor a vestibulum sed, gravida eu nunc. aliquam tempor congue
ipsum, eget vestibulum tortor volutpat dictum. phasellus rutrum justo at diam
venenatis, sed porttitor risus pulvinar. in sit amet enim eros. donec semper vel
justo ac lobortis. in hac habitasse platea dictumst.
lorem ipsum dolor sit amet\sidenote{%
\includegraphics[width=\paragraphscolwidth]{190920-standal}
}{A Tikz picture loaded from a file}
, consectetur adipiscing elit. in eu fermentum mi, vel
sagittis dolor. aenean nec leo sed justo varius egestas non nec lacus. fusce
tortor nibh, porttitor a vestibulum sed, gravida eu nunc. aliquam tempor congue
ipsum, eget vestibulum tortor volutpat dictum. phasellus rutrum justo
at diam venenatis, sed porttitor risus pulvinar. in sit amet enim eros. donec
semper vel justo ac lobortis. in hac habitasse platea dictumst.
\end{addmargin}
\end{document}