我想在左边距中写入数字。包 marginnote 不起作用,大概是因为我使用了 paracol (?) 我目前的解决方案是一个丑陋的宏 \para,它使用 (0,0) 大小的图片和 \llap 在左边距中写入文本。
这种方法有效,但在枚举/逐项列举环境中使用时,无法正确对齐数字。您知道如何确保文本始终处于相同的水平位置吗,比如说文本左侧 0.7 厘米?
非常感谢您提出的任何想法或建议!
梅威瑟:
\documentclass{article}
\usepackage[a4paper, left=2.0cm, right=2.0cm]{geometry}
\setlength{\parindent}{0cm}
\usepackage{paracol}
\newcounter{paranumber}
\globalcounter{paranumber}
\newcommand{\para}[0]{
\refstepcounter{paranumber}
\setlength{\unitlength}{1cm}
\begin{picture}(0.0,0.0)
\put(0,0){\llap{\makebox[7mm][l]{\textbf{\theparanumber}}}}
\end{picture}}
\begin{document}
\columnratio{0.6,0.4}
\setlength{\columnsep}{1.5cm}
\begin{paracol}{2}
\begin{nthcolumn}{0}
\para Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam
nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,
sed diam voluptua. At vero eos et accusam et justo duo dolores et ea
rebum.
At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd
gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.\\
\para Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum
dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr,
sed diam nonumy eirmod tempor invidunt ut labore et dolore magna
aliquyam erat, sed diam voluptua.
\end{nthcolumn}
\begin{nthcolumn}{1}
\begin{itemize}
\item \para This is item 1
\item This is item 2
\item This is item 3\para
\end{itemize}
\para At vero eos et accusam et justo duo dolores et ea rebum. Stet
clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit
amet.
\end{nthcolumn}
\end{paracol}
\para At vero eos et accusam et justo duo dolores et ea rebum. Stet
clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit
amet.
\end{document}
答案1
此解决方案tikzpagenodes
至少对文本区域使用。paracol
使用时,它使用\pcol@currcol
来确定它位于哪一列。否则,检查当前 x 位置。它可以处理 2 列以上。
请记住,tikz 需要运行两次才能知道它在页面上的位置。
\documentclass{article}
\usepackage[a4paper, left=2.0cm, right=2.0cm]{geometry}
\setlength{\parindent}{0cm}
\usepackage{paracol}
\usepackage{tikzpagenodes}
\newcounter{paranumber}
\globalcounter{paranumber}
\newlength{\paradist}
\newlength{\paraleft}
\newcount{\paracount}
\makeatletter
\newcommand{\para}[0]{%
\refstepcounter{paranumber}%
\begin{tikzpicture}[overlay,remember picture]%
\coordinate (here) at (0,0);
\pgfextractx{\paradist}{\pgfpointdiff{\pgfpointanchor{current page text area}{west}}%
{\pgfpointanchor{here}{center}}}% distance to left side of text area
\paraleft=0pt
\ifnum\col@number=1\relax% single column or paracol
\@ifundefined{pcol@currcol}% paracol not loaded
{\node[anchor=base east] at (current page text area.west |- here)
{\makebox[7mm][l]{\textbf{\theparanumber}}};}%
{\paracount=0
\loop\ifnum\paracount=\pcol@currcol\relax%
\node[anchor=base east,xshift=\paraleft] at (current page text area.west |- here)
{\makebox[7mm][l]{\textbf{\theparanumber}}};
\else
\advance\paraleft by \csname pcol@columnwidth\number\paracount\endcsname
\advance\paraleft by \csname pcol@columnsep\number\paracount\endcsname
\advance\paracount by 1
\repeat}
\else% multicol or twocolumn
\loop\ifnum\paradist<\dimexpr \paraleft+\columnwidth+0.5\columnsep\relax
\node[anchor=base east,xshift=\paraleft] at (current page text area.west |- here)
{\makebox[7mm][l]{\textbf{\theparanumber}}};
\else
\advance\paraleft by \columnwidth
\advance\paraleft by \columnsep
\repeat
\fi%
\end{tikzpicture}%
}
\makeatother
\begin{document}
\columnratio{0.6,0.4}
\setlength{\columnsep}{1.5cm}
\begin{paracol}{2}
\begin{nthcolumn}{0}
\para Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam
nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,
sed diam voluptua. At vero eos et accusam et justo duo dolores et ea
rebum.
At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd
gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.\\
\para Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum
dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr,
sed diam nonumy eirmod tempor invidunt ut labore et dolore magna
aliquyam erat, sed diam voluptua.
\end{nthcolumn}
\begin{nthcolumn}{1}
\begin{itemize}
\item \para This is item 1
\item This is item 2
\item This is item 3 \para
\end{itemize}
\para At vero eos et accusam et justo duo dolores et ea rebum. Stet
clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit
amet.
\end{nthcolumn}
\end{paracol}\leavevmode
\para At vero eos et accusam et justo duo dolores et ea rebum. Stet
clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit
amet.
\end{document}