是否可以将文本从左到右对齐,以便两列布局中的文本在垂直方向上互为镜像? 给出问题中的第二个示例ConTeXt:统一处理边距和文本中的空白,改变左列的对齐方式以align={flushright,broad}
创建不合理的参差不齐的左边缘,从而导致其比右列更长。
这是我的 MWE。第一页是预期的输入,最后一页是预期的输出。中间的所有内容都是我逐步尝试的。关于最后一页,尽管它大部分都是按预期设置的(阅读评论),但任何理智的人都不应该经历这个过程。
\setuppapersize[letter]
\setuplayout
[backspace=0.5in,
width=7.5in,
%
topspace=0.25in,
height=10.5in,
header=0.25in,
headerdistance=0.25in,
footer=0.25in,
footerdistance=0.25in,
]
\setupwhitespace[medium]
\define[1]\heading{%
\blank[big,samepage]%
\dontleavehmode{\bfc\setupinterlinespace\strut#1}%
\blank[medium,samepage]%
}
% Only used to generate the final effect.
\define[1]\rightheading{%
\blank[big,samepage]%
\dontleavehmode{\bfc\setupinterlinespace\strut\rightaligned{#1}}%
\blank[medium,samepage]%
}
\definecolumnset[TwoColumns][n=2]
\defineparagraphs[MirrorTwo][n=2]
\setupparagraphs[MirrorTwo][1][align=flushright]
\defineparagraphs[MirrorTwoB][n=2]
\showframe
\starttext
% This is the working text.
\startcolumnset[TwoColumns]
\heading{Left 1}
\samplefile{ward}
\heading{Left 2}
\samplefile{knuth}
\samplefile{weisman}
\heading{Left 3}
\startitemize
\item 1
\item 2
\item 3
\stopitemize
\samplefile{jojomayer}
\column
\heading{Right 1}
\samplefile{ward}
\heading{Right 2}
\samplefile{knuth}
\samplefile{weisman}
\heading{Right 3}
\startitemize
\item 1
\item 2
\item 3
\stopitemize
\samplefile{jojomayer}
\stopcolumnset
\page
% Here is an attempt using columnsets. Strangely enough, text overflowing
% from the right column into the left column actually introduces vertical
% whitespace at the top of the left column as if the entire left column
% were being pushed down. So comment out the overflowing text caused by an
% incorrect alignment of the left column.
\startcolumnset[TwoColumns]
\startalignment[flushright]
\heading{Left 1}
\samplefile{ward}
\heading{Left 2}
\samplefile{knuth}
\samplefile{weisman}
\heading{Left 3}
\startitemize
\item 1
\item 2
\item 3
\stopitemize
%\samplefile{jojomayer}
\stopalignment
\column
\startalignment[normal]
\heading{Right 1}
\samplefile{ward}
\heading{Right 2}
\samplefile{knuth}
\samplefile{weisman}
\heading{Right 3}
\startitemize
\item 1
\item 2
\item 3
\stopitemize
%\samplefile{jojomayer}
\stopalignment
\stopcolumnset
\page
% Here is an attempt using columns. None of the options controlling
% vertical whitespace work and columns produce more vertical whitespace
% than columnsets. So right off we have to comment out initially
% overflowing text. Then as with columnsets, the incorrect alignment of the
% left column requires commenting out the additional overflowing text.
\startcolumns[n=2,blank=small,height=0pt,]
\startalignment[flushright]
\heading{Left 1}
\samplefile{ward}
\heading{Left 2}
\samplefile{knuth}
\samplefile{weisman}
\heading{Left 3}
\startitemize
\item 1
\item 2
%\item 3
\stopitemize
%\samplefile{jojomayer}
\stopalignment
\column
\heading{Right 1}
\samplefile{ward}
\heading{Right 2}
\samplefile{knuth}
\samplefile{weisman}
\heading{Right 3}
\startitemize
\item 1
\item 2
%\item 3
\stopitemize
%\samplefile{jojomayer}
\stopcolumns
\page
% Here is an attempt using columned paragraphs. This is actually the second
% attempt, with nested paragraphs. The alignment of the left column is
% still incorrect. What's new is that the nested paragraphs have no
% separation - no vertical whitespaces - as configured by
% '\setupwhitespace'.
\startMirrorTwo
\heading{Left 1}
\samplefile{ward}
\heading{Left 2}
\samplefile{knuth}
\samplefile{weisman}
\heading{Left 3}
\startitemize
\item 1
\item 2
\item 3
\stopitemize
\samplefile{jojomayer}
\MirrorTwo
\heading{Right 1}
\samplefile{ward}
\heading{Right 2}
\samplefile{knuth}
\samplefile{weisman}
\heading{Right 3}
\startitemize
\item 1
\item 2
\item 3
\stopitemize
\samplefile{jojomayer}
\stopMirrorTwo
\page
% This was actually the first attempt using columned paragraphs. The
% headings have to be inside the paragraphs for the column splits. Overall
% this is a bulkier approach than the one immediately above, and still
% presents both issues: incorrect alignment of the left column, and missing
% separation of the nested paragraphs (even with '\par' - though '\blank'
% works). However the last issues applies only to paragraphs from
% '\samplefile'. Local nested paragraphs can be flattened into new
% outer-level paragraphs. What's interesting is that even though the
% alignment of the left column breaks alignment between the left and right
% columns, the paragraphs remain aligned.
\startMirrorTwo
\heading{Left 1}
\samplefile{ward}
\MirrorTwo
\heading{Right 1}
\samplefile{ward}
\stopMirrorTwo
\startMirrorTwo
\heading{Left 2}
\samplefile{knuth}
\MirrorTwo
\heading{Right 2}
\samplefile{knuth}
\stopMirrorTwo
\startMirrorTwo
\samplefile{weisman}
\MirrorTwo
\samplefile{weisman}
\stopMirrorTwo
\startMirrorTwo
\heading{Left 3}
\startitemize
\item 1
\item 2
\item 3
\stopitemize
\samplefile{jojomayer}
\MirrorTwo
\heading{Right 3}
\startitemize
\item 1
\item 2
\item 3
\stopitemize
\samplefile{jojomayer}
\stopMirrorTwo
\page
% Right, so here is the intended effect, which we have to build from
% scratch. Maybe this can be automated by a render setup if we can have
% access to the last line, to apply '\rightaligned'? We can't use
% paragraphs because I don't know how to setup the vertical whitespace of
% nested paragraphs, especially with '\samplefile'. If we're stuck with
% columns we should avoid simple columns '\start...stopcolumns' because
% there is too much vertical whitespace.
%
% OK so this isn't perfect. The left-column headings have more vertical
% whitespace, somehow due to '\rightaligned'. The manually hyphenated
% dashes don't match. And the itemgroup hasn't been properly aligned.
\startcolumnset[TwoColumns]
\rightheading{Left 1}
The Earth, as a habitat for animal life, is in old age and has a fatal
illness. Several, in fact. It would be happening whether humans had
ever evolved or not. But our presence is like the effect of an old-age
patient who smokes many packs of cigarettes per
\rightaligned{day—and we humans are the cigarettes.}
\rightheading{Left 2}
Thus, I came to the conclusion that the designer of a new system must
not only be the implementer and first large||scale user; the designer
should also
\rightaligned{write the first user manual.}
The separation of any of these four components would have hurt \TeX\
significantly. If I had not participated fully in all these activities,
literally hundreds of improvements would never have been made, because
I would never have thought of them or per||
\rightaligned{ceived why they were important.}
But a system cannot be successful if it is too strongly influenced by a
single person. Once the initial design is complete and fairly robust,
the real test begins as people with many different viewpoints un||
\rightaligned{dertake their own experiments.}
Since the mid-1990s, humans have taken an unprecedented step in Earthly
annals by introducing not just exotic flora or fauna from one ecosystem
into another, but actually inserting exotic genes into the operating
systems of individual plants and animals, where they're intended to do
exactly the same
\rightaligned{thing: copy themselves, over and over.}
\rightheading{Left 3}
\startitemize
\item 1
\item 2
\item 3
\stopitemize
%If we surrender the thing that separates us from machines, we will be replaced by
%machines. The more advanced machines will be, the more human
%\rightaligned{we will have to become.}
\column
\heading{Right 1}
\samplefile{ward}
\heading{Right 2}
\samplefile{knuth}
\samplefile{weisman}
\heading{Right 3}
\startitemize
\item 1
\item 2
\item 3
\stopitemize
\samplefile{jojomayer}
\stopcolumnset
\page
% Take two regarding intended effect, this time using paragraphs. Luckily
% no manual hyphenation was required this time, so no need to research
% which type of dash I'd need. The headings consume slightly more vertical
% whitespace than in columnsets, but that's relatively easy to tweak in the
% final output. For some strange reason, my custom paragraphs here are
% separate by more vertical whitespace that the standard paragraphs in
% columnsets. So, I'm still forced to comment out an '\item' entry here to
% keep everything on the same page. Also the left column is not exactly
% flushright - the hz adjustment should be applied to the left side, not
% the right. Overall its a pretty good start.
\startMirrorTwoB
\rightheading{Left 1}
The Earth, as a habitat for animal life, is in old age and has a fatal
illness. Several, in fact. It would be happening whether humans had
ever evolved or not. But our presence is like the effect of an old-age
patient who smokes many packs of cigarettes per day
\rightaligned{—and we humans are the cigarettes.}
\MirrorTwo
\heading{Right 1}
\samplefile{ward}
\stopMirrorTwoB
\startMirrorTwoB
\rightheading{Left 2}
Thus, I came to the conclusion that the designer of a new system must
not only be the implementer and first large||scale user; the designer
should also write
\rightaligned{the first user manual.}
\MirrorTwo
\heading{Right 2}
Thus, I came to the conclusion that the designer of a new system must
not only be the implementer and first large||scale user; the designer
should also write the first user manual.
\stopMirrorTwoB
\startMirrorTwoB
The separation of any of these four components would have hurt \TeX\
significantly. If I had not participated fully in all these activities,
literally hundreds of improvements would never have been made, because
I would never have thought of them or perceived
\rightaligned{why they were important.}
\MirrorTwo
The separation of any of these four components would have hurt \TeX\
significantly. If I had not participated fully in all these activities,
literally hundreds of improvements would never have been made, because
I would never have thought of them or perceived why they were
important.
\stopMirrorTwoB
\startMirrorTwoB
But a system cannot be successful if it is too strongly influenced by a
single person. Once the initial design is complete and fairly robust,
the real test begins as people with many different viewpoints undertake
\rightaligned{their own experiments.}
\MirrorTwo
But a system cannot be successful if it is too strongly influenced by a
single person. Once the initial design is complete and fairly robust,
the real test begins as people with many different viewpoints undertake
their own experiments.
\stopMirrorTwoB
\startMirrorTwoB
Since the mid-1990s, humans have taken an unprecedented step in Earthly
annals by introducing not just exotic flora or fauna from one ecosystem
into another, but actually inserting exotic genes into the operating
systems of individual plants and animals, where they're intended to do
exactly the same thing:
\rightaligned{copy themselves, over and over.}
\MirrorTwo
Since the mid-1990s, humans have taken an unprecedented step in Earthly
annals by introducing not just exotic flora or fauna from one ecosystem
into another, but actually inserting exotic genes into the operating
systems of individual plants and animals, where they're intended to do
exactly the same thing: copy themselves, over and over.
\stopMirrorTwoB
\startMirrorTwo
\rightheading{Left 3}
\startitemize
\item 1
\item 2
%\item 3
\stopitemize
\MirrorTwo
\heading{Right 3}
\startitemize
\item 1
\item 2
%\item 3
\stopitemize
\stopMirrorTwo
\startMirrorTwoB
If we surrender the thing that separates us from machines, we will be
replaced by machines. The more advanced machines will be, the more
human we will
\rightaligned{have to become.}
\MirrorTwo
If we surrender the thing that separates us from machines, we will be
replaced by machines. The more advanced machines will be, the more
human we will have to become.
\stopMirrorTwoB
\stoptext
所以基本上我试图创建一个不仅限于段落的右对齐。
以下是第一页和最后一页:
我想一个非常非常小的不起作用的例子是:
\setuppapersize[A5]
\setupalign[normal]
\showframe
\starttext
\samplefile{darwin}
\stoptext
答案1
您要查找的对齐设置称为end
。您也可以将其用作\flushedrightlastline
本地开关(如\raggedright
)。
\setuppapersize[A5]
\setupalign[end]
\define[1]\heading{%
\blank[big,samepage]%
\dontleavehmode{\bfc\setupinterlinespace\strut#1}%
\blank[medium,samepage]%
}
\showframe
\starttext
\heading{Left 1}
\samplefile{ward}
\heading{Left 2}
\samplefile{knuth}
\samplefile{weisman}
\heading{Left 3}
\startitemize
\item 1
\item 2
\item 3
\stopitemize
\samplefile{jojomayer}
\stoptext
不幸的是,这个设置似乎存在一些问题(屏幕截图中的红色省略号)。它似乎没有出现故障的规律。但因为你想使用它,所以你有责任在邮件列表并说服 Hans 修复它。具体实现如下:typo-lin.lua
。