带下支架的侧支架图像

带下支架的侧支架图像

我有一张图像,我想在左侧放置一个侧边支架,在底部放置一个下部支架。下部支架工作正常,但不知为何左侧的高度变成了图像高度的两倍。我确定图像实际上并没有那么大,我查看了像素高度。这样做是不是错误?

$r\left\{\underbrace{\includegraphics{image1.jpg}}_{k/r}\right.$

答案1

您必须将图片相对于数学轴居中:但最好为此定义一个个人命令

\documentclass{article}
\usepackage{graphicx}

\newcommand{\bracedincludegraphics}[2][]{%
  \sbox0{$\vcenter{\hbox{\includegraphics[#1]{#2}}}$}%
  \left\lbrace
    \vphantom{\copy0}
  \right.\kern-\nulldelimiterspace
  \underbrace{\box0}}

\begin{document}
$r\bracedincludegraphics{image1}$
\end{document}

该命令\bracedincludegraphics接受与 相同的选项\includegraphics

在此处输入图片描述

我将图像设置在一个框中以供稍后使用,并相对于数学轴居中(这是您尝试的主要问题,因为图像具有全部高度而没有深度,并且\left假定它必须覆盖数学轴上尽可能多的内容,如下所示)。

然后我使用框来确定左括号的大小\vphantom,用 将其关闭,并将\right.字距稍微向后调整一点;只有在这之后,我才会用下括号排版图像。

编辑

为了在下支撑和图像之间添加一个小的间隙,以下修改后的宏应该有所帮助:

\newcommand{\bracedincludegraphics}[2][]{%
  \sbox0{$\vcenter{\hbox{\includegraphics[#1]{#2}}}$}%
  \left\lbrace
    \vphantom{\copy0}
  \right.\kern-\nulldelimiterspace
  \underbrace{\vrule width0pt depth \dimexpr\dp0 + .3ex\relax\box0}}

应该.3ex是所需要的,但这取决于实际用于数学的字体。

在此处输入图片描述

答案2

您可以使用 tikz。

\documentclass[10pt,a4paper,parskip]{scrbook}
%\usepackage[T1]{fontenc}
\usepackage{tikz}
\usepackage[active,tightpage]{preview}
%
\PreviewEnvironment{tikzpicture}
\usetikzlibrary{decorations.pathreplacing}
%
\begin{document}
%
\begin{tikzpicture}

\node[anchor=south west,inner sep=0] (image) at (0,0)
{\includegraphics[width=0.9\textwidth]{image1.jpg}};
%
%To scale the dimensions of brace in case if image is scaled in future 
%   
\begin{scope}[x={(image.south east)},y={(image.north west)}]
%
%Draw grids for identifying the points easily    
\draw[help lines,xstep=.1,ystep=.1] (0,0) grid (1,1);
\foreach \x in {0,1,...,9} { \node [anchor=north] at (\x/10,0) {0.\x}; }
\foreach \y in {0,1,...,9} { \node [anchor=east] at (0,\y/10) {0.\y}; }
% Draw the braces
\draw[decorate, decoration={brace, amplitude=5pt}] (1,-0.1)--(0,-0.1);
\draw[decorate, decoration={brace, amplitude=5pt}] (-0.07,0)--(-0.07,1);
%
\end{scope}
%
\end{tikzpicture}
%   
\end{document}  

在此处输入图片描述

相关内容