2

I just have a little question. I do not know how exactly it works, but may I also make such a circle like on the photo below? The one which I have is not rounded like this and the line is very tight at the numbers. Hope you understand what I mean. Thank you for your help!!

enter image description here

\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}
6

Not sure exactly what you want but here are a few options. Using inner sep you can enlarge the distance between the text and borders. If you only want to increase the horizontal distance use inner xsep=.

enter image description here

Code:

\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}
  • Thank you!!! I do not know how to explain it in English. But is it also possible to widen the circle like on the photo above? But it would be superb if the height would remain the same...Thank you for your help : ) – hpz1719 Feb 18 '16 at 7:58
  • @hpz1719: Have updated the solution to show how to do that. – Peter Grill Feb 18 '16 at 8:28
4

Another approach would be to use the two options available in TikZ that are minimum width and minimum height. If you do not change the inner sep that would give the result you want:

\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}

Options minimum width and minimum height

You can then define a new command, in this case the optional argument is the minimum width:

\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}

\mybox

If you do not specify the optional argument the dimension of the box is set according to inner sep.

  • Thank you also for your help!! I am sorry I cannot klick twice on the checkmark sign... – hpz1719 Feb 18 '16 at 9:13
2

An easy solution with 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} 

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.