2

The simplest way to produce Gödel codes is with $\ulcorner$ and $\urcorner$, and we may write $\ulcorner p\urcorner$ to enclose the formula $p$ within codes.

Buss programmed a macro which gives a better appearance than Gödel codes in many contextst.

The macro Godeln{}, which egreg recently suggested, as an aside in an answer to a recent question (Dotted x in mathmode), is an improvement of Buss's improvements of \(\ulcorner \urcorner\).

My question is: May the corners of the egreg codes be rounded, e.g. with TikZ, to obtain codes which are discernibly different?

MWE

\documentclass[]{article}
\usepackage{amsmath, amssymb}

\newlength{\gnCornerHgt}
\newlength{\gnArgHgt}

\makeatletter
\newcommand{\Godeln}[1]{\mathinner{\mathpalette\Godeln@{#1}}}
\newcommand{\Godeln@}[2]{%
    \begingroup
    \settoheight{\gnCornerHgt}{$\m@th#1\ulcorner$}%
    \settoheight{\gnArgHgt}{$\m@th#1#2$}%
    \ifdim\gnArgHgt<\gnCornerHgt
    \setlength{\gnArgHgt}{0pt}%
    \else
    \addtolength{\gnArgHgt}{-\gnCornerHgt}%
    \fi 
    \raisebox{\gnArgHgt}{$\m@th#1\ulcorner$}%
    #2%
    \raisebox\gnArgHgt{$\m@th#1\urcorner$}%
    \endgroup
}
\makeatother

\begin{document}
    
    $\ulcorner 2^2\urcorner$ vs. $\Godeln{2^2}$
    
    
\end{document}  
10
  • 1
    I fear, I don't really understand what you want to achieve, but you cannot simply round the corner of a glyph, in this case the glyphs which the macros \ulcorner and \urcorner output. You cannot transform the path of a glyph, but you can use another glyph or you can create your own "rounded corner" glyphs using TikZ if this is what you want. Commented Feb 8, 2023 at 19:24
  • 2
    Having said that, it would be nice if you could clean up your question and make it better readable for others. It is not a good idea in my opinion that your put the question inside your MWE. Question and MWE should be separate parts of the post. Commented Feb 8, 2023 at 19:26
  • @JasperHabicht Thanks, I did some more edits, which I think also clarify that the question is on whether "you can create your own "rounded corner" glyphs using Tikz. Commented Feb 8, 2023 at 22:52
  • Please format your code correctly. I did this for you but you undid my edit.
    – Sandy G
    Commented Feb 8, 2023 at 22:59
  • 1
    No problem. I reformatted it. Hope that's ok.
    – Sandy G
    Commented Feb 8, 2023 at 23:13

2 Answers 2

6

A variant of Sandy G's code. The main differences are

  1. how the baseline is treated, so we're guaranteed that the symbol has the correct one

  2. the argument to \godel is typeset in math mode.

  3. the sidebearings are fixed and don't shrink nor stretch

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}

\newcommand{\sandygodel}[2][]{{}\mathbin{\vcenter{\hbox{\tikz{
  \node[inner ysep=-1pt, inner xsep=3pt](M){#2\strut};
  \draw[rounded corners=.5mm, #1]([xshift=-.3em]M.north east)--(M.north east)--++(0,-.3em);
  \draw[rounded corners=.5mm, #1]([xshift=.3em]M.north west)--(M.north west)--++(0,-.3em);
}}}}{}}


\newcommand{\godel}[2][]{%
  \mspace{1\medmuskip}%
  \vphantom{#2}%
  \begin{tikzpicture}[baseline=(M.south)]
    \node[inner ysep=0pt,inner xsep=3pt](M){\smash[b]{$#2\mathstrut$}};
    \draw[rounded corners=.5mm,#1]([xshift=-1mm]M.north east)--(M.north east)--++(0,-.1);
    \draw[rounded corners=.5mm,#1]([xshift=1mm]M.north west)--(M.north west)--++(0,-.1);
  \end{tikzpicture}%
  \mspace{1\medmuskip}%
}

\begin{document}

\tableofcontents

\section{Egreg's $\godel{A}$ and $\godel[thick]{A}$}

Some examples: $\godel{a}\godel{A}\godel{g}\godel{(}$

Squeezed: \hbox spread -10pt{$\godel{a}\godel{A}$}

Math: $\godel{r\in R}$

\medskip

{\Large Some examples: $\godel{a}\godel{A}\godel{g}\godel{(}$}

\section{Sandy's $\sandygodel{A}$ and $\sandygodel[thick]{A}$}

Some examples: $\sandygodel{a}\sandygodel{A}\sandygodel{g}\sandygodel{(}$

Squeezed: \hbox spread -10pt{$\sandygodel{a}\sandygodel{A}$}

Math: $\sandygodel{$r\in R$}$

\medskip

{\Large Some examples: $\sandygodel{a}\sandygodel{A}\sandygodel{g}\sandygodel{(}$}

\end{document}

enter image description here

3
  • Thanks! Does this produce another out pute than your answer to this question: tex.stackexchange.com/questions/674695/… ? Commented Feb 10, 2023 at 18:00
  • 1
    @Sapiens The version here is more refined.
    – egreg
    Commented Feb 10, 2023 at 18:08
  • Great! I accept your answer, as a guidance for those who might be interested in finding the best available answer to my query. But Sandy G deserves much recognition as well. Commented Feb 10, 2023 at 18:18
9

Here is a somewhat simpler draw-it-yourself version with TikZ. You can adjust the radius of the rounded corners by changing the .5mm in the \draw commands. You can adjust the horizontal spacing by changing inner xsep, and the vertical spacing by changing inner ysep.

enter image description here

There is also an optional argument that can be used to change the \draw style. For example, \godel[thick]{a}. Colors work too.

\documentclass{article}

\usepackage{tikz}

\DeclareRobustCommand{\godel}[2][]{{}\mathbin{\vcenter{\hbox{\tikz{
  \node[inner ysep=-1pt, inner xsep=3pt](M){#2\strut};
  \draw[rounded corners=.5mm, #1]([xshift=-.3em]M.north east)--(M.north east)--++(0,-.3em);
  \draw[rounded corners=.5mm, #1]([xshift=.3em]M.north west)--(M.north west)--++(0,-.3em);
}}}}{}}

\begin{document}

Some examples: $\godel{a}\godel{A}\godel{g}\godel{(}$

\section{Here is a G\"odel code $\godel[thick]{a}$}

\end{document}
9
  • Thanks. With me \section{ $\protect\godel[thick]{A}$} gives many errors so that the document does not compile. The first error is: Argument of \pgfkeys@temp has an extra }. \section{ $\protect\godel[thick]{A}$} Commented Feb 9, 2023 at 16:25
  • 1
    @Sapiens: I can't reproduce that error. Maybe a typo? If you can't figure it out you could post a new question with a link to this one.
    – Sandy G
    Commented Feb 9, 2023 at 16:32
  • What gave me problems was: \section{$\protect\godel[thick]{A}$ is ...}. Commented Feb 9, 2023 at 16:40
  • No, I almost resolved it by using: : \section{~} {\Large \noindent \textbf{19} \indent $\godel{A}$ \textbf{is true just if the end of A is truth}} A drawback is that there is now a lineshift after the Section number. Commented Feb 9, 2023 at 16:45
  • 1
    I am also unable to reproduce any of the errors @Sapiens says he (or she?) is getting.
    – Mico
    Commented Feb 9, 2023 at 21:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .