This is my first time playing with ConText and, while I'd like to think I have some decent programming experience, TeX code is something I've never worked with before (and am sufficiently intimidated by).
Long story short, I'm trying to get a three-column layout with vertical rules separating each column, like the journal Science:
I've played a bit around with columnsets and pagecolumns (as suggested on the wiki), but I'm struggling to get the rules how I'd like them. The wiki suggests using some METAFUN code for drawing rules, but unfortunately it's not quite what I'm looking for:
- There is an unneeded rule on the right side of the page – for
Nnumber of columns, I'll always wantN - 1rules separating them - The rules continue past the end of the text, even drawing when there is no text in a column at all!
Here is where I'm at:
% Margins
\setuplayout[
backspace=13mm, width=middle,
topspace=13mm, height=middle,
header=0mm, footer=0mm]
% Page Columns
\startuseMPgraphic{verticalrule}
if CurrentColumn < 3 :
draw rightboundary OverlayBox shifted (4mm,0);
setbounds currentpicture to OverlayBox enlarged 2.5mm;
fi
\stopuseMPgraphic
\defineoverlay
[verticalrule]
[\useMPgraphic{verticalrule}]
\startpagecolumns[n=3,background=verticalrule]
Gives me:
And on the second page, showing off the second issue:

I'm honestly struggling with getting the height of the actual text (not the whole text area, but the non-blank space) and can't quite figure out a way to get around the extra rule during my playing around with METAFUN. Maybe I need this all to be a page background and not a column overlay? How would that help with my issue #2 though?
I'd greatly appreciate any help you could offer!
Thanks in advance!
Brooks
EDIT:
Here is some code for a minimal working example! The text is a bit bigger and has some ragged bottom edges (what's that all about?) after I removed the custom font:
% Common Imports
\usemodule[ipsum]
% Basic Document Setup
\mainlanguage[en]
\setuppapersize[A4]
% Margins
\setuplayout[
backspace=13mm, width=middle,
topspace=13mm, height=middle,
header=0mm, footer=0mm]
% Page Columns
\startuseMPgraphic{verticalrule}
if CurrentColumn < 3 :
draw rightboundary OverlayBox shifted (4mm,0);
setbounds currentpicture to OverlayBox enlarged 2.5mm;
fi
\stopuseMPgraphic
\defineoverlay
[verticalrule]
[\useMPgraphic{verticalrule}]
\startpagecolumns[n=3,background=verticalrule]
% Dummy Text
\starttext
\setupalign[tolerant,stretch,hanging,hz]
\ipsum
\ipsum
\ipsum
\ipsum
\ipsum
\ipsum
\ipsum
\ipsum
\stoptext
DOUBLE EDIT:
Here is my output for context -version:
mtx-context | ConTeXt Process Management 1.04
mtx-context |
mtx-context | main context file: /usr/share/texmf-dist/tex/context/base/mkiv/context.mkiv
mtx-context | current version: 2021.03.05 19:11
mtx-context | main context file: /usr/share/texmf-dist/tex/context/base/mkxl/context.mkxl
mtx-context | current version: 2021.03.05 19:11
And when I run Wolfgang's suggested code with context Article.tex:
resolvers | formats | executing runner 'run luatex format': /usr/bin/luatex --jobname="Article" --fmt=/home/tll/.texlive/texmf-var/luatex-cache/context/0399a8df3aef8d154781d0a9c2b8e28d/formats/luatex/cont-en.fmt --lua=/home/tll/.texlive/texmf-var/luatex-cache/context/0399a8df3aef8d154781d0a9c2b8e28d/formats/luatex/cont-en.lui cont-yes.mkiv --c:currentrun=1 --c:fulljobname="./Article.tex" --c:input="./Article.tex" --c:kindofrun=1 --c:maxnofruns=9 --c:texmfbinpath="/usr/bin"
This is LuaTeX, Version 1.15.0 (TeX Live 2022/Arch Linux)
system commands enabled.
open source > level 1, order 1, name '/usr/share/texmf-dist/tex/context/base/mkiv/cont-yes.mkiv'
system >
system > ConTeXt ver: 2021.03.05 19:11 MKIV fmt: 2022.5.17 int: english/english
system >
system > 'cont-new.mkiv' loaded
open source > level 2, order 2, name '/usr/share/texmf-dist/tex/context/base/mkiv/cont-new.mkiv'
system > beware: some patches loaded from cont-new.mkiv
close source > level 2, order 2, name '/usr/share/texmf-dist/tex/context/base/mkiv/cont-new.mkiv'
system > files > jobname 'Article', input './Article', result 'Article'
fonts > latin modern fonts are not preloaded
languages > language 'en' is active
open source > level 2, order 3, name '/home/spinning/tll/Documents/University/Y4S2/Literature Review/ConTeXt (RIP)/Article.tex'
fonts > preloading latin modern fonts (second stage)
fonts > 'fallback modern-designsize rm 12pt' is loaded
Underfull \hbox (badness 1342) in paragraph at lines 1--36
<1: lmroman12-regular @ 12.0pt> sem-per quis fringilla ut, viverra
Underfull \hbox (badness 1342) in paragraph at lines 1--36
<1: lmroman12-regular @ 12.0pt> sem-per quis fringilla ut, viverra
Underfull \hbox (badness 1342) in paragraph at lines 1--36
<1: lmroman12-regular @ 12.0pt> sem-per quis fringilla ut, viverra
Underfull \hbox (badness 1342) in paragraph at lines 1--36
<1: lmroman12-regular @ 12.0pt> sem-per quis fringilla ut, viverra
Underfull \hbox (badness 1342) in paragraph at lines 1--36
<1: lmroman12-regular @ 12.0pt> sem-per quis fringilla ut, viverra
Underfull \hbox (badness 1342) in paragraph at lines 1--36
<1: lmroman12-regular @ 12.0pt> sem-per quis fringilla ut, viverra
Underfull \hbox (badness 1342) in paragraph at lines 1--36
<1: lmroman12-regular @ 12.0pt> sem-per quis fringilla ut, viverra
Underfull \hbox (badness 1342) in paragraph at lines 1--36
<1: lmroman12-regular @ 12.0pt> sem-per quis fringilla ut, viverra
Underfull \hbox (badness 1342) in paragraph at lines 1--36
<1: lmroman12-regular @ 12.0pt> sem-per quis fringilla ut, viverra
metapost > initializing instance 'metafun:1' using format 'metafun' and method 'default'
metapost > loading 'metafun' as '/usr/share/texmf-dist/metapost/context/base/mpiv/metafun.mpiv' using method 'default'
metapost > initializing number mode 'scaled'
backend > xmp > using file '/usr/share/texmf-dist/tex/context/base/mkiv/lpdf-pdx.xml'
pages > flushing realpage 1, userpage 1, subpage 1
pages > flushing realpage 2, userpage 2, subpage 2
close source > level 2, order 3, name '/home/spinning/tll/Documents/University/Y4S2/Literature Review/ConTeXt (RIP)/Article.tex'
close source > level 1, order 3, name '/usr/share/texmf-dist/tex/context/base/mkiv/cont-yes.mkiv'
mkiv lua stats > used config file: selfautodir:/share/texmf-dist/web2c/texmfcnf.lua
mkiv lua stats > used cache path: readable+writable: '/home/tll/.texlive/texmf-var/luatex-cache/context/0399a8df3aef8d154781d0a9c2b8e28d'
mkiv lua stats > resource resolver: loadtime 0.055 seconds, 0 scans with scantime 0.000 seconds, 0 shared scans, 31 found files, scanned paths: <none>
mkiv lua stats > stored bytecode data: 454 modules (0.176 sec), 96 tables (0.008 sec), 550 chunks (0.183 sec)
mkiv lua stats > traced context: maxstack: 1422, freed: 2, unreachable: 1420
mkiv lua stats > cleaned up reserved nodes: 57 nodes, 9 lists of 442
mkiv lua stats > node memory usage: 17 attribute, 6 attribute_list, 3 glue, 51 glue_spec, 3 kern, 4 penalty, 2 temp, 2 user_defined
mkiv lua stats > node list callback tasks: 8 unique task lists, 7 instances (re)created, 374 calls
mkiv lua stats > driver time: 0.050 seconds
mkiv lua stats > used backend: pdf (backend for directly generating pdf output)
mkiv lua stats > jobdata time: 0.001 seconds saving, 0.000 seconds loading
mkiv lua stats > callbacks: internal: 842, file: 229, direct: 2, late: 18, function 627, total: 1718 (859 per page)
mkiv lua stats > randomizer: resumed with value 0.47691170172766
mkiv lua stats > positions: 3 collected, 3 regular, 0 special
mkiv lua stats > result saved in file: Article.pdf, compresslevel 3, objectcompresslevel 1
mkiv lua stats > loaded patterns: en::1, load time: 0.000
mkiv lua stats > loaded fonts: 2 files: latinmodern-math.otf, lmroman12-regular.otf
mkiv lua stats > font engine: otf 3.113, afm 1.513, tfm 1.000, 7 instances, 3 shared in backend, 3 common vectors, 0 common hashes, load time 0.106 seconds
mkiv lua stats > metapost: 0.001 seconds, loading: 0.010, execution: 0.001, n: 8, average: 0.001, instances: 1, luacalls: 56, memory: 2.851 M
mkiv lua stats > used platform: linux-64, type: unix, binary subtree: usr
mkiv lua stats > used engine: luatex version: 1.15, functionality level: 7509, banner: this is luatex, version 1.15.0 (tex live 2022/arch linux)
mkiv lua stats > used hash slots: 46520 of 65536 + 200000
mkiv lua stats > lua properties: engine: lua 5.3, used memory: 147 MB, ctx: 147 MB, max: unknown MB, hash chars: min(64,40), symbol mask: utf (τεχ)
mkiv lua stats > runtime: 0.396 seconds, 2 processed pages, 2 shipped pages, 5.051 pages/second
system | total runtime: 0.572 seconds
And end up with the same issue of rules after the last column:








Maybe that would mean tying the METAFUN graphics to paragraphs instead of whole columns?
– Brooks Apr 25 '22 at 09:36Sciencelayout, it is not inConTexthowever hence the comment. The question and answer here auto balances the end columns (a major issue is putting images in which I am trying to work through or maybe will need to bounty some time soon), the question and working answer is here, maybe it helps! Failing that, hopefully someone can answer your question :) – May 05 '22 at 21:31