1

I was wandering if it would be possible and not a daunting task to obtain in ConTeXt the edges of a frame excluding its intersection with other two edges. By an example, to obtain the left edge without points also in bottom and top edges. I think it could be very useful if one wants to draw thick vertical lines between words, cause one can manage very easily the height of the vertical line (a lateral edge of a frame) in a way that this height doesn't change with the thickness. I looked for a solution but I found nothing. Perhaps in order to implement that, one must touch very deep the code that controls the behaviour of \framed. Or in general, the problem is to find a way of putting (in title) a vertical line controlling at the same time and independently: a) its thickness; b) its bottom line c) its top line. The issue with boxes is something that could solve it, but I don't know if it is an efficient way, and I cannot figure out some another. The problem can be set this way:

Consider this code:

\setupalign[hanging]
\definecolor[marca][red]
\setuphead
  [chapter]
  [
    page=yes,sectionsegments=chapter,
    before={\blank[force,4*line]},
    after={\blank[4*line]},strut=no,
    command=\mychap, numberstyle=\tfd
  ]

\definebodyfontenvironment[default][d=3.3]

\defineframed
  [chapterframeda]
  [
    offset=0em,
    frame=off,
    strut=no,
    align={flushright,nothypenated},
    location=top,
    foregroundstyle=sans,
    rulethickness=5pt 
  ]

\defineframed 
  [chapterframedb]
  [
    offset=0em,
    %frame=off,
    strut=no,
    align={flushleft,nothypenated},
    location=top,
    foregroundstyle=sans,
    rulethickness=5pt,
  ]

\define[2]\mychap
  {\hbox \bgroup
    \headsetupspacing
    %\hfill
    \chapterframeda[width=2cm, framecolor=marca]{#1}
    \chapterframedb[width=\textwidth,framecolor=marca,leftframe=on,align=normal,location=bottom]{#2}
    \egroup}

\setuppagenumbering
  [alternative=doublesided,
    location=]

\setupheader
  [style=\ss, strut=no]

\setupheadertexts
  [] [\setups{text:header:1}]
  [\setups{text:header:2}] []

\startsetups text:header:1
  \getmarking[chapter][current]
  \quad\chapterframeda[height=1.5em,framecolor=marca,leftframe=on]{}
  \quad\pagenumber
\stopsetups

\startsetups text:header:2
  \quad\chapterframedb[align=normal,location=top,frame=off]{\pagenumber}
  \quad\chapterframedb[framecolor=marca, leftframe=on,align=normal,location=top]{Platonismo pleno y estructuralismo {\it ante rem}} 
\stopsetups

\definetext
  [chapterstart]
  [footer]
  [pagenumber]

\newdimen\Margin
\Margin=3cm

\newdimen\MarginRaise
\MarginRaise=56ex

\setuplayout
  [
    backspace=4.3cm,
    width=fit,
    height=middle,footer=\bodyfontsize,
    header=3\bodyfontsize,
    headerdistance=\bodyfontsize,
    bottom=3\bodyfontsize,
    location={middle,doublesided},
    margin=\Margin,
    rightmargin=3.5cm,
    marking=on
  ]

\showgrid

\starttext         

\chapter{Presentación de la doctrina}

\stoptext

The two frames are there only to provide a vertical line as separator between number and text, the left edge of the frame created with \chapterframedb. But I am looking for a separator of exactly the height of the text inside the frame, in both cases the height of the initial "P". I thought that if I could obtain the left edge of that frame without the points that belongs also to the top or bottom edges, this could be done trivially. But I don't know if it is feasible and i've tryied others methods to obtain a separator of which I could decide its bottom, its top and its thikness all at a time, and I 've obtained nothing.

  • Just so that I understand correctly, you want a frame with different thickness of the top line and the bottom line? Usually, this is done with metapost. If you can show some visual examples of what you want, i can post the corresponding metapost code. – Aditya Aug 10 '16 at 2:49
  • I've edited the question. Thank you very much for your interest. – Miguel Aug 10 '16 at 5:21
2

I wouldn't use any fancy \framed solution but just the good old \vrule. If you don't specify height and depth the \vrule will assume the height and depth of the current line.

\definecolor[marca][red]
\setuphead
  [chapter]
  [
    page=no, % for this example
    strut=no,
    command=\mychap,
    numberstyle=\tfd,
  ]

\definebodyfontenvironment[default][d=3.3]

\define[2]\mychap
  {\headsetupspacing
    \dontleavehmode
    \hbox to 2cm {\hss #1\hskip10pt}%
    \hskip15pt
    \vtop{%
      \hsize=\dimexpr\textwidth-2cm-15pt
      \hskip-15pt\color[marca]{\vrule width 5pt}\hskip10pt
      #2}%
  }

\showgrid

\starttext

\startchapter[title={Presentación de la doctrina and some more text to force a linebreak}]
\stopchapter

\startchapter[title={g}]
\stopchapter

\stoptext

enter image description here


For this solution the title of your chapter shouldn't be longer than one line but the code is easier.

\definecolor[marca][red]
\setuphead
  [chapter]
  [
    page=no, % for this example
    strut=no,
    command=\mychap,
    numberstyle=\tfd,
  ]

\definebodyfontenvironment[default][d=3.3]

\define[2]\mychap
  {\hbox \bgroup
    \headsetupspacing
    \hbox to 2cm {\hss #1\ }%
    \hbox to \dimexpr\textwidth-2cm {\color[marca]{\vrule width 5pt}\ #2\hss}
    \egroup}

\showgrid

\starttext

\startchapter[title={Presentación de la doctrina}]
\stopchapter

\startchapter[title={g}]
\stopchapter

\stoptext

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.