这是我的问题(很抱歉我自己没有找到解决方案)。
\documentclass[10pt,paper=a4]{scrbook}
\usepackage[modulo]{lineno}
\usepackage{blindtext}
\begin{document}
This is a text for an example. I want the numbers on the left of each line to be aligned with the text outside the environment.
\begin{linenumbers}
\blindtext[1]
\end{linenumbers}
\end{document}
默认情况下,lineno
包会将其编号与页面边缘的左侧对齐。它看起来像这样:
然而,我希望它看起来像这样:
因此,我希望编号部分与正文的边缘对齐。有人能帮忙吗?提前谢谢!
答案1
您真正想要做的是更改编号段落的左边距,因此除了更改长度之外,您还需要执行此操作\linenumbersep
。我创建了一个numbered
可以执行此操作的新环境:
\documentclass[10pt,paper=a4]{scrbook}
\usepackage[modulo]{lineno}
\newenvironment{numbered}{%
\addtolength{\leftskip}{2\parindent}
\setlength{\linenumbersep}{-.5\parindent}
\begin{linenumbers}}
{\end{linenumbers}}
\usepackage{blindtext}
\begin{document}
This is a text for an example. I want the numbers on the left of each line to be aligned with the text outside the environment.
\begin{numbered}
\blindtext[1]
\end{numbered}
\end{document}