2

I have successfully managed to get my subssubection between two lines. Now I want the two lines to be red, while the text remains black.

I have tried to put \textcolor{red} in various parts of the command, but it gives an error. How could I make the lines appear red?

This is my MVE:

\documentclass[ebook,11pt,twoside,openright,showtrims]{memoir}
\usepackage{lipsum}
\usepackage{xcolor}  
\newcommand*\ruleline[1]{\par\noindent\raisebox{.8ex}{\makebox[\linewidth]{\hrulefill\hspace{1ex}\raisebox{-.8ex}{#1}\hspace{1ex}\hrulefill}}}
\renewcommand\subsubsecheadstyle{\Large\noindent\ruleline}
%\textcolor{red}
\begin{document}
    \subsubsection{Homilía (1982): Despertar}
    
    \lipsum[1]
    
\end{document}

The output:

enter image description here

2 Answers 2

4

Hope this is the one, you expects:

\newcommand*\ruleline[1]{\par\noindent\raisebox{.8ex}{\makebox[\linewidth]{{\color{red}\hrulefill}\hspace{1ex}\raisebox{-.8ex}{#1}\hspace{1ex}{\color{red}\hrulefill}}}}
0
4

Like this?

\documentclass[ebook,11pt,twoside,openright,showtrims]{memoir}
\usepackage{lipsum}
\usepackage{xcolor}  
\newcommand*\ruleline[1]{\par\noindent\raisebox{.8ex}{\makebox[\linewidth]{\textcolor{red}{\hrulefill}\hspace{1ex}\raisebox{-.8ex}{#1}\hspace{1ex}\textcolor{red}{\hrulefill}}}}
\renewcommand\subsubsecheadstyle{\Large\noindent\ruleline}
\begin{document}
    \subsubsection{Homilía (1982): Despertar}
    
    \lipsum[1]
    
\end{document}

enter image description here

1
  • It works too. Thanks.
    – A. Cedano
    Feb 10, 2021 at 14:46

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.