I managed to create a custom sectioning command because of Werner's help here and–in relation to the optional arguments–this solution here.
Is it possible to enhance the macro for a sectioning command with tikz features? I'd like to reference the corners of the heading itself and thought to wrap it in a node command. Well it was worth a try, but maybe tikz is not the right tool for this or I just lack the deeper knowledge of LaTeX?
In relation to the mockup-picture, I would like to
get rid of space above the horizontal part of the tikz lines (which are located above the section-command, i.e. the space is marked with blue) and
have the vertical tikz lines reach the lower corner of the heading (the red part of the tikz lines, i.e. directly next to the heading itself).
Are these 2 points possible?
With help/a hint by Martin, I managed to create a version of what I intend, but it clearly is not fully functional yet (it produces errors) and does not look like it should.
Mock-up of goal
Screenshot of MWE (not working)
MWE
\documentclass[
11pt,
a4paper,
parskip=false-
]
{scrartcl}
\usepackage{
lmodern,
blindtext,
multicol,
tikz,
etoolbox
}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\RedeclareSectionCommands[
beforeskip=0pt,
afterskip=3pt,
tocentryformat=\small,
toclinefill=\small\TOCLineLeaderFill,
tocpagenumberformat=\small,
% addtokomafont=\Large
]{subsection}
\addtokomafont{subsection}{\Large}
%=================================
% hide section headings - circumvent with fake heading
%src: https://tex.stackexchange.com/a/129985/25683
%=================================
\newcommand{\myownsec}[1]{%
\par\refstepcounter{section}% Increase section counter
\sectionmark{#1}% Add section mark (header)
% \addcontentsline{toc}{section}{\protect\numberline{\thesection}#1}% Add section to ToC
\addcontentsline{toc}{section}{#1}% Add section to ToC
% Add more content here, if needed.
}
%***********************************************************
%***********************************************************
% OLD version - works, but does not look the part
% (src: https://tex.stackexchange.com/a/586911/25683)
%***********************************************************
%***********************************************************
%\NewDocumentCommand{\specialthing}{ o m }{%
%%\par\vspace{0ex}
%\begin{tikzpicture}
%[
%overlay,
%]
%\draw[
%semithick,
%color={black!30!blue},
%] (0,0) -- (0.95\columnwidth,0) -- (0.95\columnwidth,-0.5);
%\draw[
%semithick,
%color={black!50!green}
%] (0.1,-0.1) -- (0.94\columnwidth,-0.1) -- (0.94\columnwidth,-0.4);
%\end{tikzpicture}\par\vspace{0ex}
%\subsection[\IfValueTF{#1}{#1}{#2}]{#2}
%}
%***********************************************************
%***********************************************************
% NEW version - does not work, would probably look like it should
%***********************************************************
%***********************************************************
\newrobustcmd{\specialthing}[1]{%
\texorpdfstring{%
\begin{tikzpicture}
\node (sectionnode) {#1};
\draw[orange] (sectionnode.north west) -- (sectionnode.north east) -- (sectionnode.south east);
\end{tikzpicture}}{8iohsdfg}}
%\DeclareRobustCommand{\specialthing}{\texorpdfstring{\tikz\node{pgf};}{replacement text}}
%\chapter{hello \TikzStuff}
%\usepackage[showframe]{geometry}
\listfiles
\begin{document}
\begin{multicols*}{2}
\myownsec{Word}
%\tikz\node{pgf};\
\subsection{bla \specialthing{asdf}}
\blindtext[1]
\blindtext[1]
\blindtext[1]
\blindtext[1]
%\specialthing{AAAAAA aaaa bbbb cccc dd eeeee}
\blindtext[1]
\end{multicols*}
\end{document}




specialthingthe following:\node[inner sep = 0, outer sep = 0pt], then you will see that asdf is in line with the rest. How to keep going afterwards, I cannot help you :( – Jes Mar 14 '21 at 12:46{8iohsdfg}is on purpose, right? You are introducing it by using your command – Jes Mar 14 '21 at 12:47inner sep-values. Also, yes, the "8io.." was a stupid oversight. – henry Mar 14 '21 at 19:58