TransWikia.com

How can I put only the left and right lines in red in a command?

TeX - LaTeX Asked on August 7, 2021

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]{parnoindentraisebox{.8ex}{makebox[linewidth]{hrulefillhspace{1ex}raisebox{-.8ex}{#1}hspace{1ex}hrulefill}}}
renewcommandsubsubsecheadstyle{Largenoindentruleline}
%textcolor{red}
begin{document}
    subsubsection{Homilía (1982): Despertar}
    
    lipsum[1]
    
end{document}

The output:

enter image description here

2 Answers

Hope this is the one, you expects:

newcommand*ruleline[1]{parnoindentraisebox{.8ex}{makebox[linewidth]{{color{red}hrulefill}hspace{1ex}raisebox{-.8ex}{#1}hspace{1ex}{color{red}hrulefill}}}}

Answered by MadyYuvi on August 7, 2021

Like this?

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

enter image description here

Answered by DG' on August 7, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP