侧边栏或侧边栏与对象垂直对齐

侧边栏或侧边栏与对象垂直对齐

我正在写一份文件(回忆录),其中大量使用了侧边注释。我非常喜欢侧边注释根据其所附单词的行位置垂直对齐的功能。我的文档确实需要此功能,因为许多侧边注释都需要解释文本中出现的单个单词。

但是,每当我有一个对象(例如表格)时,我不能只将侧边栏放在该对象旁边,因为这样它就会出现在该对象底线以下一行。

有没有办法让我的侧边栏与对象的第一行对齐,而无需改变同一单词行附加行为?(侧边栏似乎不是一个好的解决方案)。

谢谢你,A

\documentclass[a3paper, 14pt, twoside, showtrims]{memoir}

\settrimmedsize{340mm}{210mm}{*}
\settrims{0mm}{86,99mm}
\setlrmarginsandblock{23.3mm}{46.7mm}{*}
\setulmarginsandblock{23.3mm}{54.9mm}{*}
\setmarginnotes{2.8mm}{23.3mm}{1em}
\renewcommand{\sideparfont}{\normalfont\itshape\fontsize{11pt}{13pt \selectfont‌​}
\renewcommand{\footnotesize}{\normalfont\fontsize{11pt}{13pt}\selectfont‌​}
\sideparmargin{outer} 



\checkandfixthelayout[nearest] 

    \begin{document}

\begin{center}

\textit{\Large Table containing several numbers} 

\large with no particular meaning.

\end{center}

\begin{center}\begin{tabular}{ | c | c | c | c | c | c | c | c | c | c | c | c | c | c | c | c | }
\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 \\
\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 \\
\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 \\
\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 \\
\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 \\
\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 \\
\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 \\
\hline
\end{tabular} \end{center} \sidebar{Sidebar}

A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text.


\begin{center}\begin{tabular}{ | c | c | c | c | c | c | c | c | c | c | c | c | c | c | c | c | }
\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 \\
\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 \\
\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 \\
\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 \\
\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 \\
\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 \\
\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 \\
\hline
\end{tabular} \end{center}\sidepar{Sidepar}

A few lines with random text.\sidebar{Sidebar is aligned at the top of the page.} A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text.\sidepar{Sidepar is 'anchored' to the line to which it is attached.} A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text. A few lines with random text.

\end{document}

答案1

我找到了一个简单易行的解决方案:

\documentclass[a3paper, 14pt, twoside, showtrims]{memoir}

\settrimmedsize{340mm}{210mm}{*}
\settrims{0mm}{86,99mm}
\setlrmarginsandblock{23.3mm}{46.7mm}{*}
\setulmarginsandblock{23.3mm}{54.9mm}{*}
\setmarginnotes{2.8mm}{23.3mm}{1em}
\renewcommand{\sideparfont}{\normalfont\itshape\fontsize{11pt}{13pt}\selectfont‌​}
\renewcommand{\footnotesize}{\normalfont\fontsize{11pt}{13pt}\selectfont‌​}
\sideparmargin{outer} 



\checkandfixthelayout[nearest] 

\begin{document}


\sidepar {Sidepar}

\vspace{-\baselineskip}
\begin{tabular}{ | c | c | c | c | c | c | c | c | c | c | c | c | c | c | c | c | }
\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 \\
\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 \\
\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 \\
\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 \\
\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 \\
\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 \\
\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 \\
\hline
\end{tabular} 

\end{document}

答案2

\sidepar 似乎与底部对齐,而不是与基线对齐。此外,居中似乎对 \sidepar (即 \hfil) 有奇怪的效果。

侧标试验

\documentclass[a3paper, 14pt, twoside, showtrims]{memoir}

\settrimmedsize{340mm}{210mm}{*}
\settrims{0mm}{86.99mm}
\setlrmarginsandblock{23.3mm}{46.7mm}{*}
\setulmarginsandblock{23.3mm}{54.9mm}{*}
\setmarginnotes{2.8mm}{23.3mm}{1em}
%\renewcommand{\sideparfont}{\normalfont\itshape\fontsize{11pt}{13pt \selectfont‌​}
\renewcommand{\footnotesize}{\normalfont\fontsize{11pt}{13pt}\selectfont‌​}
\sideparmargin{outer} 

\checkandfixthelayout[nearest]

\newsavebox{\tempbox}
\newlength{\tempdepth}

\newcommand{\raisesidepar}[2]% #1 = distance, #2 = text
{\sidepar{\raisebox{#1}{\parbox[t]{\marginparwidth}{#2}}}}

\begin{document}

% \sidepar is alligned to bottom, not baseline
\hfill\rule[-1cm]{1pt}{1cm} Baseline is up here.\sidepar{Sidepar}

yada yada yada

% This appears to be about .5\baselineskip too high
\hfill\rule[-1cm]{1pt}{1cm} Baseline is up here.%
\sidepar{\raisebox{1cm}{\parbox[t]{\marginparwidth}{Raised content}}}

yada yada yada

\hfill\raisebox{0pt}[\height][0pt]{\rule[-1cm]{1pt}{1cm} Baseline is up here.}%
\sidepar{Zero depth}%
\vspace{1cm}

yada yada yada

\savebox{\tempbox}{% compute depth
\begin{tabular}[t]{ | c | c | c | c | c | c | c | c | c | c | c | c | c | c | c | c | }
\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 \\
\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 \\
\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 \\
\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 \\
\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 \\
\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 \\
\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 \\
\hline
\end{tabular}}%
\settodepth{\tempdepth}{\usebox{\tempbox}}%
% In this case 0pt doesn't work as well
\noindent\hfil\raisebox{0pt}[\height][\baselineskip]{\usebox{\tempbox}}%
\sidepar{Sidepar}%
\vspace{\tempdepth}

yada yada yada

\addtolength{\tempdepth}{-\baselineskip}
\noindent\hfil\usebox{\tempbox}\raisesidepar{\tempdepth}{Sidepar}%
\vspace{\baselineskip}% not sure why this is needed

yada yada yada

\end{document}

相关内容