-
Notifications
You must be signed in to change notification settings - Fork 1
/
refrq.tex
58 lines (49 loc) · 2.72 KB
/
refrq.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
% Required packages
\usepackage{tcolorbox}
\usepackage{hyperref}
% Avoid expanding it when in a textual label
\MakeRobust{\ref}
% Enables labeling text and directly linking to it. Courtesy of https://tex.stackexchange.com/a/292890
\makeatletter
\newcommand{\labeltext}[2]{%
\@bsphack
\csname phantomsection\endcsname % in case hyperref is used
\def\@currentlabel{#1}{\label{#2}}%
\@esphack
}
\makeatother
% Hightlighting box around a specified text (argument 1). The fallback colour for the box is magenta, but another
% colour can be specified (argument 2) if needed.
% arg1 : To-be highlighted text
% arg2 (optional): Box-colour
% example: \highlight[cyan]{This is some text}
\newtcbox{\highlight}[1][magenta]{on line, arc=5pt,colback=#1!10!white,colframe=#1!50!black, before upper={\rule[-3pt]{0pt}{10pt}},boxrule=1pt, boxsep=0pt,left=4pt,right=3pt,top=2pt,bottom=1pt}
% ATTENTION: CASE SENSITIVE!
% Creates a research question for the paper. This entails a hightlighted-box with a label for the question and an
% italic text that is "saved" for later referencing. An invisible version of the text is placed at the position of
% the original text with a big label around it for easy referencing and linking to.
% arg1: RQ-Label
% arg2: Text of the research question
% example: \researchq{RQ1}{This is a \textbf{resarch} question!}
\newcommand{\researchq}[2]{
\noindent % No indent please :)
\highlight{\textbf{\texttt{\textcolor{gray}{#1}}}} % Creates the coloured box for the label
\textit{#2} % Displays the actual text of the question in italics, keeping all additional formatting
\labeltext{\highlight{\textbf{\texttt{\textcolor{gray}{#1}}}} \textit{#2}} % "Saving" the rq incl. question text. It's placed invisibly at the position of the actual question, so it can be easily reference and linked to.
{rq:#1} % The specific label for this rq; label-name is equivalent to "rq:" + arg1
}
% ATTENTION: CASE SENSITIVE!
% Pretty wrapper function to reference a research question.
% arg1: The rq that is to be referenced
% example: \refrq{RQ1}
\newcommand{\refrq}[1]{\ref{rq:#1}}
% ATTENTION: CASE SENSITIVE!
% Show the label of the research question without a label-reference-link and without the text.
% arg1: The rq that is to be referenced
% example: \norefrq{RQ1}
\newcommand{\norefrq}[1]{\highlight{\textbf{\texttt{\textcolor{gray}{#1}}}}}
% ATTENTION: CASE SENSITIVE!
% Show the label of the research question with a label-reference-link but without the text.
% arg1: The rq that is to be referenced
% example: \notextrefrq{RQ1}
\newcommand{\notextrefrq}[1]{\hyperref[rq:#1]{\highlight{\textbf{\texttt{\textcolor{gray}{#1}}}}}}