我有这样的文字:
\begin{flushleft}
\fontsize{16pt}{16pt}\selectfont\textit{some text}\\
\fontsize{16pt}{16pt}\selectfont\textit{some text}
\end{flushleft}
我想要一个填充框,该框下方是半透明颜色(例如白色或浅灰色)。我找到了几个 beamer 示例,但这是一份报告,我认为在 Latex 中,beamer 与报告在这方面有所不同。
我很感激你们的支持,提前谢谢你们,
答案1
只需tikz
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
\node[fill=olive,fill opacity=0.3,rounded
corners=1ex,font=\fontsize{16pt}{16pt}\itshape] (a) {Some text};
\node[preaction={fill=olive},rounded corners=1ex,below=of
a,font=\fontsize{16pt}{16pt}\itshape] (b) {Some text};
\node[preaction={fill=olive,fill opacity=0.5},rounded corners=1ex,below=of
b,font=\fontsize{16pt}{16pt}\itshape] (c) {Some text};
\end{tikzpicture}
\end{document}
和tcolorbox
\documentclass{article}
\usepackage[many]{tcolorbox}
\begin{document}
\begin{tcolorbox}[
width=\textwidth,
arc=3mm,
% auto outer arc,
boxsep=0cm,
toprule=1pt,
leftrule=1pt,
bottomrule=1pt,
rightrule=1pt,
colframe=blue,
fontupper=\raggedleft\itshape]
\fontsize{16pt}{16pt}
Some text
\end{tcolorbox}%
\end{document}
这是一个具有透明度的环境版本:
\documentclass{article}
\usepackage[many]{tcolorbox}
\usepackage{lmodern} % just to avoid font size warnings
\newtcolorbox{mybox}[1][]{
width=\textwidth,
arc=3mm,
% auto outer arc,
boxsep=0cm,
toprule=1pt,
leftrule=1pt,
bottomrule=1pt,
rightrule=1pt,
colframe=blue,
fontupper=\raggedleft\fontsize{16pt}{16pt}\itshape,
breakable,
nobeforeafter,
enhanced jigsaw,
opacityframe=0.5,
opacityback=0.5
}
\begin{document}
\begin{mybox}[]
Some text here just to fill the line and see if the line breaks smoothly and goes to the next. If not, I am in deep trouble ;-)
\end{mybox}
\end{document}
这也会跨页面。