如果有人能帮助我实现这个结果,我会很高兴——制作类似水印的东西,但把它放在我的特定位置minipage
(如屏幕截图所示)
这是我的代码:
\documentclass[a4paper,14pt]{extreport}
\usepackage[left=0.5cm,right=0.5cm,
top=1.5cm,bottom=1.5cm,bindingoffset=0cm]{geometry}
%------------------
\usepackage{lstautogobble} % Fix relative indenting
\usepackage{color} % Code coloring
\usepackage{zi4} % Nice font
\definecolor{bluekeywords}{rgb}{0.13, 0.13, 1}
\definecolor{greencomments}{rgb}{0, 0.5, 0}
\definecolor{redstrings}{rgb}{0.9, 0, 0}
\definecolor{graynumbers}{rgb}{0.5, 0.5, 0.5}
\usepackage{listings}
\lstset{
basicstyle=\ttfamily,
columns=fullflexible,
frame=single,
breaklines=true,
postbreak=\mbox{\textcolor{red}{$\hookrightarrow$}\space},
}
%------------------
\begin{document}
\begin{table}[h!]
\begin{tabular}{c | c}
\begin{minipage}[m]{0.4\textwidth}
some text or picture
\end{minipage}
&
\begin{minipage}[m]{0.55\textwidth}
\begin{lstlisting}[basicstyle=\scriptsize]
some text
\end{lstlisting}
\end{minipage}
\end{tabular}
\end{table}
\end{document}
答案1
您省略了生成章节标题和节标题(3.1
在本例中为节)的代码,但猜测该部分,您可以手动向后前进(即向负方向移动)以垂直重新排列项目的位置,然后使用重叠等。
使用fontspec
包设置字体的颜色和不透明度,并titlesec
使用包将其应用于部分标签,如下所示:
平均能量损失
\documentclass[a4paper,14pt]{extreport}
\usepackage[left=0.5cm,right=0.5cm,
top=1.5cm,bottom=1.5cm,bindingoffset=0cm]{geometry}
%------------------
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{fontspec}
\newfontfamily\fmysec{Noto Serif}[Scale=5,Colour=red,Opacity=0.3]
\usepackage{titlesec}
\titlelabel{{\fmysec \thetitle}}
\usepackage{lstautogobble} % Fix relative indenting
%\usepackage{color} % Code coloring
\usepackage{zi4} % Nice font
\definecolor{bluekeywords}{rgb}{0.13, 0.13, 1}
\definecolor{greencomments}{rgb}{0, 0.5, 0}
\definecolor{redstrings}{rgb}{0.9, 0, 0}
\definecolor{graynumbers}{rgb}{0.5, 0.5, 0.5}
\usepackage{listings}
\lstset{
basicstyle=\ttfamily,
columns=fullflexible,
frame=single,
breaklines=true,
postbreak=\mbox{\textcolor{red}{$\hookrightarrow$}\space},
}
%------------------
\begin{document}
\chapter{x}
\chapter{x}
\chapter{\ \\[-1em] Code, listings, minted \ldots}
\section{\hspace{1.5in}\llap{\normalsize\mdseries\raisebox{7em}{Code listing using \textit{minted} in \colorbox{red!7}{Beamer}}}}
%\begin{table}[h!] % table float not needed
\vspace{-5em}
\begin{tabular}{c | c}
\begin{minipage}[m]{0.4\textwidth}
some text or picture
\end{minipage}
&
\begin{minipage}[m]{0.55\textwidth}
\begin{lstlisting}[basicstyle=\scriptsize]
some text
\end{lstlisting}
\end{minipage}
\end{tabular}
% \end{table}
\end{document}
答案2
对我来说完美的解决方案:
\documentclass[a4paper,14pt]{extreport}
\usepackage[left=0.5cm,right=1.5cm,
top=1.5cm,bottom=1.5cm,bindingoffset=0cm]{geometry}
%------------------
\usepackage{tikz}
\usepackage{lstautogobble} % Fix relative indenting
\usepackage{color} % Code coloring
\usepackage{zi4} % Nice font
\definecolor{bluekeywords}{rgb}{0.13, 0.13, 1}
\definecolor{greencomments}{rgb}{0, 0.5, 0}
\definecolor{redstrings}{rgb}{0.9, 0, 0}
\definecolor{graynumbers}{rgb}{0.5, 0.5, 0.5}
\usepackage{listings}
\lstset{
basicstyle=\ttfamily,
columns=fullflexible,
frame=single,
breaklines=true,
postbreak=\mbox{\textcolor{red}{$\hookrightarrow$}\space},
}
%------------------
\begin{document}
\begin{tabular}{c | c}
\begin{minipage}[m]{0.4\textwidth}
\begin{tikzpicture}
\node (0,0) {
\includegraphics[width=0.9\linewidth]{example-image}
};
\node [opacity=0.05] (0,0) {\scalebox{10.0}{\textcolor{red}{3.1}}};
\end{tikzpicture}
\end{minipage}
&
\begin{minipage}[m]{0.5\textwidth}
\begin{lstlisting}[basicstyle=\scriptsize]
\begin{minipage}[m]{0.4\textwidth}
\begin{tikzpicture}
\node (0,0) {
\includegraphics[width=0.9\linewidth]{example-image}
};
\node [opacity=0.2] (0,0) {\scalebox{10.0}{\textcolor{red}{3.1}}};
\end{tikzpicture}
\end{minipage}
\end{lstlisting}
\end{minipage}
\end{tabular}
\end{document}