1

I have used tikz to create a system of section headers that provide different 'marker' options that highlight different kinds of section, thus:

enter image description here

I have defined a markerfont, Gill Sans, medium weight. Which is sampled in the Normal section. I have also used it in the marker, 'Topic 1'. I have been unable to find a way to use it for the other two markers, 'topic summary' and 'Summary', which seem to take their cue from the section header, which is emphasised bold.

Is there a way to force these two markers to also take on the medium-weight marker font, without also taking on the bold characteristic? I don't want to change the main light font variant used in the body of the text, but it is too lightweight to be used in the markers.

(This question was originally incorporated in a larger question, Using tikz to create section “bars” and “markers”, which I managed to (largely) answer myself. I thought that the seemingly minor element described above would be straightforward to solve, but that has proven not to be so, hence my seeking guidance on this aspect separately).

MWE:

    \documentclass[a5paper, openany]{memoir}     

    \usepackage{fontspec}                           %   glurl.co/fs0
    \defaultfontfeatures{Ligatures=TeX}
    \setmainfont{Gill Sans Light}
    \newfontfamily\gills{Gill Sans}
        \DeclareTextFontCommand{\markerfont}{\gills}

\setlrmarginsandblock{0.85in}{0.85in}{*}    

    \usepackage{lipsum}

\usepackage[usenames,dvipsnames]{xcolor}        
            \definecolor    {bar}           {gray}{0.7}
            \definecolor    {marker}        {named}{black}

%   section bar headings defined, using tikz

\usepackage[explicit]{titlesec}         %   glurl.co/dFH
\usepackage{tikz}
\usetikzlibrary{shapes.misc}

\makeatletter
\let\currentsectiontitle\relax

\newcommand\sectionbar{
            \tikz[baseline,trim left=\trim,trim right=\trimright] {
                \fill [\barfill] (2.25cm,-1ex) rectangle (\textwidth+3cm,2.5ex);
                \node [fill=\markerfill, anchor= base east, rounded rectangle,
                        minimum height=3.5ex] at 
                (13.8cm,{\vertical+\vadjust}) {\sectionmarker};
                \node [fill=\barfill, anchor= base east, rounded rectangle,
                        minimum height=3.5ex] at 
                (\markerinset,\vertical) {};
                    }}          

            \def\sectionmarker{\null}
            \def\barfill{bar}
            \def\markerfill{bar}

            \def\trim{2.815cm}% inset unmarked bar
            \def\trimright{2.7cm}% inset header to match text
            \def\markerinset{2.6cm}
            \def\vertical{0.145}
            \def\vadjust{0}

\newcommand\@sectionbar{
    \def\trim{3.6cm}% inset marked bars
            \def\trimright{2.75cm}% inset marked headers to match text
            \def\markerinset{2.58cm}
            \def\vertical{0.13}
    \def\vadjust{-0.0875}
    \def\markerfill{marker}
    \sectionbar}

\def\@@topic{Topic}         
\def\@@summary{Summary}
    \def\@@topicsummary{topic summary}

\newcommand\@topic{
    \def\sectionmarker{\color{white}{\space \@@topic \space \thesection}}
            \@sectionbar}

\newcommand\@summary{
        \def\sectionmarker{\color{white}{\@@summary}}
            \@sectionbar}

\newcommand\@topicsummary{
        \def\sectionmarker{\color{white}{\@@topicsummary}}
            \@sectionbar}

\titleformat
    {\section}
    {\large}        %   explore \flushright, \raggedleft
    {\markerfont\@topic}
    {-0.01cm}
    {\bfseries\gdef\currentsectiontitle{#1}#1}

\renewcommand*{\thesection}{\arabic{section}}

\newcommand{\osection}[1]{
                    \section*{\sectionbar#1}}
\newcommand{\ssection}[1]{
                    \section*{\@summary#1}}
\newcommand{\tsection}[1]{
                    \section*{\@topicsummary#1}}

\makeatother


    \begin{document}

    \chapter{Title}
    \label{title}

    \section{Normal section}
    \label{firstsection}

    \markerfont {this is marker font (Gills Sans) -- a medium weight font}

    \osection{Osection sample}
    \label{termsusedinthisstudy}

    \tsection{Tsection sample}
    \label{topicsummarised}

    \ssection{Ssection sample}
    \label{study1summarised}

\lipsum[1]

    \end{document}
johnbrc
  • 575

0 Answers0