%% -*- coding: utf-8 -*-
%% Timestamp: "2025-09-30 18:03:32 (ywatanabe)"
%% File: "/ssh:sp:/home/ywatanabe/proj/neurovista/paper/00_shared/latex_styles/formatting.tex"

%% --- Image width ---
\newlength{\imagewidth}
\newlength{\imagescale}

%% --- Line numbers ---
\linespread{1.2}
\linenumbers

%% --- Colors ---
\definecolor{GreenBG}{rgb}{0,1,0}
\definecolor{RedBG}{rgb}{1,0,0}

%% --- Highlight boxes ---
\newtcbox{\greenhighlight}[1][]{on line,colframe=GreenBG,colback=GreenBG!50!white,boxrule=0pt,arc=0pt,boxsep=0pt,left=1pt,right=1pt,top=2pt,bottom=2pt,tcbox raise base}
\newtcbox{\redhighlight}[1][]{on line,colframe=RedBG,colback=RedBG!50!white,boxrule=0pt,arc=0pt,boxsep=0pt,left=1pt,right=1pt,top=2pt,bottom=2pt,tcbox raise base}

\newcommand{\REDSTARTS}{\color{red}}
\newcommand{\REDENDS}{\color{black}}
\newcommand{\GREENSTARTS}{\color{green}}
\newcommand{\GREENENDS}{\color{black}}

%% --- Word count ---
\newread\wordcount
\newcommand\readwordcount[1]{%
\openin\wordcount=#1
\read\wordcount to \thewordcount
\closein\wordcount
\thewordcount
}

%% --- Text highlighting ---
\usepackage{soul}
\sethlcolor{yellow}

%% --- Reference handling ---
\usepackage{refcount}

\let\oldref\ref
\newcommand{\hlref}[1]{%
  \ifnum\getrefnumber{#1}=0
    \colorbox{yellow}{\ref*{#1}}%  % Use colorbox for references (no line break needed)
  \else
    \ref{#1}%
  \fi
}

% To add an 'S' prefixes to a reference
\newcommand*\sref[1]{S\hlref{#1}}
\newcommand*\sfref[1]{Supplementary Figure S\hlref{#1}}
\newcommand*\stref[1]{Supplementary Table S\hlref{#1}}
\newcommand*\smref[1]{Supplementary Materials S\hlref{#1}}

%%%% EOF