4

I used tcolorbox to make a semi-transparent box as explained in this link. What I need is to offset this box from the center of the texwidth, this means crossing a bit the border of the textwidth. Is there a way to achieve this with tcolorbox? I tried flushright environment but the box doesn't go further than the textwidth border.

Any hint is appreciated, thanks in advance,

tcolorbox code:

\documentclass{report}
\usepackage{tcolorbox}
\usepackage{showframe}

\newtcolorbox{frontcoverbox}[1][]{
    width=0.7\textwidth,
    %arc=3mm,
    %auto outer arc,
    boxsep=0cm,
    toprule=1pt,
    leftrule=1pt,
    bottomrule=1pt,
    rightrule=1pt,
    colframe=white,
    fontupper=\raggedleft\fontsize{14pt}{14pt}\itshape,
    breakable,
    nobeforeafter,
    enhanced jigsaw,
    opacityframe=0.35,
    opacityback=0.35
}

\begin{document}

\begin{frontcoverbox}[]
    \textbf{Photo:} yaba daba du\\
    \textbf{Place:} de la refurinfunflai\\
    \textbf{Provided by:} Krusty the Clown
\end{frontcoverbox}

\end{document}

UPDATE:

Based on this code, adding enlarge left by=5cm to the frontcoverbox did the trick, thanks to Harish Kumar for that!

3
  • 1
    Perhaps you should try \rlap{\tcolorbox{…}}.
    – Bernard
    Sep 5, 2014 at 22:02
  • 1
    Please always post complete documents not just fragments so people can reproduce exactly what you are seeing Sep 5, 2014 at 22:22
  • @DavidCarlisle sorry about that, always the MWE =) I think that should work
    – Gery
    Sep 5, 2014 at 22:27

1 Answer 1

5
\documentclass{report}
\usepackage[many]{tcolorbox}     %% you left [many], needed for breakable option
\usepackage{showframe}

\newtcolorbox{frontcoverbox}[1][]{
    width=0.7\textwidth,
    before=\hskip2.5\textwidth,
    %arc=3mm,
    %auto outer arc,
    boxsep=0cm,
    toprule=1pt,
    leftrule=1pt,
    bottomrule=1pt,
    rightrule=1pt,
    colframe=white,
    fontupper=\raggedleft\fontsize{14pt}{14pt}\itshape,
    breakable,
    nobeforeafter,
    enhanced jigsaw,
    opacityframe=0.35,
    opacityback=0.35,
    enlarge left by=1in,    %% this one here pushed to right
}

\begin{document}

\begin{frontcoverbox}[]
    \textbf{Photo:} yaba daba du\\
    \textbf{Place:} de la refurinfunflai\\
    \textbf{Provided by:} Krusty the Clown
\end{frontcoverbox}

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .