围绕一个数字

围绕一个数字

我只是有个小问题。我不知道它到底是如何工作的,但我也可以画出像下面照片中那样的圆圈吗?我手上的这个不是像这样圆的,而且数字处的线很紧。希望你明白我的意思。谢谢你的帮助!!

在此处输入图片描述

\documentclass[a4paper]{article}
    \usepackage{geometry} \geometry{a4paper, top=25mm, left=25mm, right=25mm, bottom=20mm, headsep=10mm, footskip=12mm} 
    \usepackage[ngerman]{babel}  
    \usepackage[T1]{fontenc}         
    \usepackage[latin1]{inputenc}   
    \usepackage{amsmath}
    \usepackage{amssymb}
    \usepackage{multirow,array}
    \usepackage{arydshln}  
    \usepackage{tikz}        
    \dashlinegap=1pt                   
    \usepackage{acronym}

    \newcommand\mybox[3][]{%
        \tikz[anchor=base,baseline]\node[inner sep=2pt,draw=#2,#1]{$\displaystyle#3\mathstrut$};}
    \colorlet{mycol}{black}


    \begin{document}

        \begin{table}
            \renewcommand\arraystretch{1.5}
            \setlength{\tabcolsep}{4mm}
            \begin{tabular}{*{5}{>{$}c<{$}}}
                & & \multicolumn{2}{c}{Player II}& \\ 
                & & \multicolumn{1}{c}{H}  & \multicolumn{1}{c}{T} & \underset{s_1 \in S_1}{min} \, u(s_1, s_2) \\\cline{3-4}
                \multirow{2}*{Player I}
                & H & \multicolumn{1}{|c|}{1} & \multicolumn{1}{c|}{-1} &\multicolumn{1}{l}{-1} \\ \cline{3-4}
                & T & \multicolumn{1}{|c|}{-1} & \multicolumn{1}{c|}{-1} &\multicolumn{1}{l}{-1} \\ \cline{3-4}
                \multicolumn{1}{r@{}}{$\underset{s_2 \in S_2}{min} \, u(s_1, s_2)$} & & 1 &1 & 
                \multicolumn{1}{l}{\mybox[rounded corners]{mycol}{1,1}}

            \end{tabular}
        \end{table}

    \end{document}

答案1

不确定您到底想要什么,但这里有几个选项。使用inner sep可以扩大文本和边框之间的距离。如果您只想增加水平距离,请使用inner xsep=

在此处输入图片描述

代码:

\documentclass[a4paper]{article}
\usepackage{tikz}        

\newcommand\mybox[3][]{%
    \tikz[anchor=base,baseline]\node[inner sep=2pt,draw=#2,#1]{$\displaystyle#3\mathstrut$};}
\colorlet{mycol}{black}


\begin{document}
    \mybox[rounded corners]{mycol}{1,1}
    \mybox[rounded corners=2pt]{mycol}{1,1}
    \mybox[rounded corners=6pt]{mycol}{1,1}
    \mybox[rounded corners=6pt, inner sep=2pt]{mycol}{1,1}
    \mybox[rounded corners=6pt, inner sep=4pt]{mycol}{1,1}
    \mybox[rounded corners=6pt, inner sep=6pt]{mycol}{1,1}

    \mybox[rounded corners=6pt, line width=1pt, draw=red, fill=yellow!25]{mycol}{1,1}
    
    \mybox[rounded corners=6pt, line width=1pt, draw=blue, fill=green!25, inner xsep=8pt]{mycol}{1,1}
\end{document}

答案2

另一种方法是使用 Ti 中提供的两个选项Z 是minimum widthminimum height。如果不改变 ,inner sep将得到您想要的结果:

\documentclass[10pt,a4paper]{article}
\usepackage{tikz}
\begin{document}
\tikz \node[rounded corners,draw] {0,1}; \tikz \node[rounded corners,draw,minimum width=1cm] {0,1}; \tikz \node[rounded corners,draw,minimum width=2cm] {0,1};\\

\tikz \node[rounded corners,draw,minimum height=1cm] {0,1}; \tikz \node[rounded corners,draw,minimum height=1cm,minimum width=1cm] {0,1};
\end{document}

选项最小宽度和最小高度

然后您可以定义一个新命令,在这种情况下可选参数是最小宽度:

\documentclass[10pt,a4paper]{article}
\usepackage{tikz}
\newcommand{\mybox}[2][0]{\tikz \node[draw,rounded corners,minimum width=#1] {#2};}
\begin{document}
\mybox{1,1} \mybox[1cm]{1,1} \mybox[1.5cm]{1,1}
\end{document}

\我的盒子

如果不指定可选参数,则根据设置框的尺寸inner sep

答案3

一个简单的解决方案pstricks

\documentclass[x11names, french]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{babel}
\usepackage{amsmath,array, siunitx}
\sisetup{output-decimal-marker={,}}
\usepackage{pst-node}
\usepackage{auto-pst-pdf}

\newcommand\myovalbox[1]{ \psframebox[framearc=1, framesep=4pt, linecolor=IndianRed3]{\hskip 0.33em#1\hskip 0.33em}}

\begin{document}

\[ \myovalbox{\num{1,3}} \quad\myovalbox{\num{1,333}}\]%

\end{document} 

在此处输入图片描述

相关内容