1

In \framebox I do not see any color options. I have trying to look at its definition using \show to define a new command but what \show shows does not provide any help

Richard
  • 210
  • \framebox uses the current colour, so you could do \textcolor{red}{\framebox{\textcolor{black}{<content>}}}. – Skillmon Feb 24 '21 at 14:10

1 Answers1

1

If you do not have great demands, the command command \fcolorbox might be enough:

\documentclass{article}
\usepackage{color}
\newcommand{\myfbox}[1]{\fcolorbox{red}{white}{#1}}

\begin{document}

\fcolorbox{green}{white}{Hello world}

\myfbox{Hello world}

\end{document}

enter image description here

Ivan
  • 4,368
  • Thank you Ivan, what I want is to put a blue frame in every page of my document, there is an old solution for this in https://tex.stackexchange.com/questions/68464/vector-frame-on-all-pages now it runs in a single page, it does not work if the document has several pages. With framebox I am able to do this but only with black lines. I was looking for the definition of framebox to define a new command colouring the hrules, I looked for the definition with \show and searched the tree of .sty files to no avail – Richard Feb 24 '21 at 14:04
  • Maybe it's best if you open a new question: "how to put a blue frame in every page of my document?", which is actually your question here. The link you provided works even in document with several pages. – Ivan Feb 24 '21 at 14:16
  • I copy-pasted the solution using tikz and it worked as long as the text does not extends more than one page, only if I manually insert \newpage commands it works for more pages. The solution given in https://tex.stackexchange.com/questions/559677/page-borders-on-specific-pages-followup-to-an-answer-from-another-question works but I do not see how I can change the color. – Richard Feb 24 '21 at 14:26
  • I found it, using the answer given in 559677 and simply adding \color{blue}: – Richard Feb 24 '21 at 14:48
  • \AddToShipoutPicture{ \thinlines\color{blue} \setlength{\Page@FrameHeight}{\paperheight-\PageFrameTopMargin-\PageFrameBottomMargin} \setlength{\Page@FrameWidth}{\paperwidth-\PageFrameLeftMargin-\PageFrameRightMargin} \put(\strip@pt\PageFrameLeftMargin,\strip@pt\PageFrameTopMargin){ \framebox(\strip@pt\Page@FrameWidth, \strip@pt\Page@FrameHeight){}}} – Richard Feb 24 '21 at 14:48
  • 1
    Again, the code available here: https://tex.stackexchange.com/questions/68464/vector-frame-on-all-pages puts a box on each page. Anyway, to change the color in the last solution you provided use: {\color{red}\framebox(\strip@pt\Page@FrameWidth, \strip@pt\Page@FrameHeight){}} in place of \framebox(\strip@pt\Page@FrameWidth, \strip@pt\Page@FrameHeight){} – Ivan Feb 24 '21 at 14:50
  • Yes, I found it thanks a lot Ivan – Richard Feb 24 '21 at 14:51