如何仅在页面的一部分的右边距内创建垂直条

如何仅在页面的一部分的右边距内创建垂直条
\documentclass[english]{book}
%------------------------------------------------------------------------------------ %
%
\usepackage[fleqn]{amsmath} %
\usepackage{amsthm,amssymb} %
\usepackage{tikz} % tikz - essential
\usepackage[T1]{fontenc} %
\usepackage{newtxtext} %
\usepackage{newtxmath} %
\usepackage{xcolor} %
\usepackage{colortbl} % changed to just colortbl
\usepackage[paperwidth=170mm,paperheight=240mm,textwidth=132mm,lmargin=12.5mm,rmargin=12.5mm,bindingoffset=12.5mm,noheadfoot,nomarginpar,showframe,showcrop]{geometry} %
\usepackage[a4,frame,cam,center]{crop} 
\usepackage{setspace}
%
% --------------------------------------- START DECLARATIONS --------------------------- %
%
\setlength{\unitlength}{1pt} 
\setlength{\parskip}{0pt}
\setlength\parindent{0pt}

\newenvironment{eq}[2]{%
  \setlength{\mathindent}{#1}%
  \setlength{\hsize}{\dimexpr\hsize-#2\relax}%
  \ignorespaces
}{\ignorespacesafterend}

\renewcommand{\theequation}{\thechapter.\arabic{equation}}

\newcommand\dashfill{\leaders\hbox to 18pt{\hss-\hss}\hskip\fill\hspace{-12pt}}

\begin{document}

\setstretch{1.25}
Using the latest 64-bit versions of Technic Center and MiKTeX 2.9\hspace{2.2pt}\ldots

\vspace{6pt}
How can I create a vertical bar just inside the right margin to draw attention to only \\ a selected mixture of math mode and normal text?

I would like to control its thickness and colour.

\vspace{12pt}
I do not want to include this line of text.

I do not want to include this line of text.

I do not want to include this line of text.

\vspace{6pt}
I want the vertical bar to commence at this level > > >

Some introductory remarks\ldots

\vspace{-24pt}
\begin{eq}{124pt}{24pt}
\begin{equation}
l+m=m+l \dashfill \label{eqn:chap_intro_to_num_02}
\end{equation}
\end{eq}

\vspace{-24pt}
\begin{eq}{106pt}{24pt}
\begin{equation}
(l+m)+n=l+(m+n)\dashfill \label{eqn:chap_intro_to_num_04}
\end{equation}
\end{eq}

Some comment on the equations that I want to include.

I want the vertical bar to cease at this level > > >

\vspace{12pt}
I do not want to include this text.

I do not want to include this text.

I do not want to include this text.


\end{document}

答案1

好的,您可以利用环境的帮助来实现垂直条tabular。解决同一问题的另一种方法可能是使用tikzpagenodes包,但在这种情况下,有人比我更优秀,可以提供帮助。

因此,在这个特定的例子中,我使用了colortbl包来控制垂直条的宽度和颜色。高度将由您在环境中包含的内容自动确定tabular。我已使用p对齐说明符来允许文本在环境内换行,并将表格宽度设置为0.95\textwidth,部分原因是您定义环境的方式eq。我已为条形图着色blue,但您可以随意更改,并将条形图宽度设置为3ptvia \vrule width。因此,的参数总计tabularp{0.95\textwidth}!{\color{blue}\vrule width 3pt}。使用添加了一些虚拟文本lipsum

样本

完整代码如下:

\documentclass[english]{book}
%------------------------------------------------------------------------------------ %
%
\usepackage[fleqn]{amsmath} %
\usepackage{amsthm,amssymb} %
\usepackage{tikz} % tikz - essential
\usepackage[T1]{fontenc} %
\usepackage{newtxtext} %
\usepackage{newtxmath} %
\usepackage{xcolor} %
\usepackage{colortbl} % changed to just colortbl
\usepackage[paperwidth=170mm,paperheight=240mm,textwidth=132mm,lmargin=12.5mm,rmargin=12.5mm,bindingoffset=12.5mm,noheadfoot,nomarginpar,showframe,showcrop]{geometry} %
\usepackage[a4,frame,cam,center]{crop} 
\usepackage{setspace}

\usepackage{lipsum}

\usepackage{colortbl} % For vertical bar control in tabular environment.


%
% --------------------------------------- START DECLARATIONS --------------------------- %
%

\setlength{\unitlength}{1pt} 
\setlength{\parskip}{0pt}
\setlength\parindent{0pt}

\newenvironment{eq}[2]{%
  \setlength{\mathindent}{#1}%
  \setlength{\hsize}{\dimexpr\hsize-#2\relax}%
  \ignorespaces
}{\ignorespacesafterend}

\renewcommand{\theequation}{\thechapter.\arabic{equation}}

\newcommand\dashfill{\leaders\hbox to 18pt{\hss-\hss}\hskip\fill\hspace{-12pt}}

\begin{document}

\setstretch{1.25}
Using the latest 64-bit versions of Technic Center and MiKTeX 2.9\hspace{2.2pt}\ldots

\vspace{6pt}
How can I create a vertical bar just inside the right margin to draw attention to only \\ a selected mixture of math mode and normal text?

I would like to control its thickness and colour.

\vspace{12pt}
I do not want to include this line of text.

I do not want to include this line of text.

I do not want to include this line of text.

\vspace{6pt}
I want the vertical bar to commence at this level > > >

\begin{tabular}{p{0.95\textwidth}!{\color{blue}\vrule width 3pt}}
Some introductory remarks\ldots

\lipsum[66]

\vspace{-24pt}
\begin{eq}{124pt}{24pt}
\begin{equation}
l+m=m+l \dashfill \label{eqn:chap_intro_to_num_02}
\end{equation}
\end{eq}

\vspace{-24pt}
\begin{eq}{106pt}{24pt}
\begin{equation}
(l+m)+n=l+(m+n)\dashfill \label{eqn:chap_intro_to_num_04}
\end{equation}
\end{eq}

Some comment on the equations that I want to include.

\lipsum[75]

\end{tabular}

I want the vertical bar to cease at this level > > >

\vspace{12pt}
I do not want to include this text.

I do not want to include this text.

I do not want to include this text.

\end{document}

相关内容