3

enter image description here

I know esint package can type line integral with square paths: $\sqint$, but today I need a square arrowed line integral. Does anyone know how to do it ?

user74489
  • 141

2 Answers2

3

A proposotoin with the \stackinset command from stackengine, \squint from esint and \Lsh from mathabx (without loading mathabx):

\documentclass{article}
\usepackage{amsmath, amssymb,}
\usepackage{nccmath}
\usepackage{esint}


\DeclareFontFamily{U}{mathb}{\hyphenchar\font45}
\DeclareFontShape{U}{mathb}{m}{n}{ <-6> mathb5 <6-7> mathb6 <7-8>
mathb7 <8-9> mathb8 <9-10> mathb9 <10-12> mathb10 <12-> mathb12 }{}
\DeclareSymbolFont{mathb}{U}{mathb}{m}{n}
%
\DeclareMathSymbol{\Lsh}{\mathrel}{mathb}{"E8}
\usepackage{xcolor} 
 \usepackage{stackengine} %
\newcommand{\mysqint}{\mathop{{\stackMath\stackinset{c}{0.03ex}{c}{0.235ex}{\scriptstyle\Lsh}{\sqint}}}}

\begin{document}

\[ I = \mysqint g(z)\,\mathrm d z \]

\end{document} 

enter image description here

Bernard
  • 271,350
2

Today I also found myself wanting a similar symbol, the difference being that I wanted the arrow to be on the vertical edge to the right of the square. I found two helpful post: this one, and this one. Making some tweaks to these, I arrived at the following solution, which was sufficient for my purposes:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[margin=1.2in]{geometry}
\usepackage{amsfonts,amssymb,amsmath,amsthm}
\usepackage{mathabx}
\usepackage{enumerate}
\usepackage{lmodern}
\usepackage{physics} % Differentials
\usepackage{xcolor}  % Colors 
\usepackage{placeins} % FloatBarrier
\usepackage{array}
\usepackage{tikz-cd} % Commutative diagrams
\usetikzlibrary{matrix,arrows,backgrounds}
\usepackage{centernot}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{hyperref}
\usepackage{nccmath}
\usepackage{esint}

% Approach 1:

% Contour integral with box and upward-pointing arrow. % Needs the package esint and nccmath \newcommand{\boxintanticlockwise}{\mathop{\mathpalette\docircint\relax}! \sqint}

% Determine what to do based on where the symbol is beign used: \newcommand{\docircint}[2]{% \ifx#1\displaystyle \displaycircint \else \normalcircint{#1}% \fi }

% (Display style = Math on separate line) \newcommand{\displaycircint}{\scriptsize \boldsymbol{\wedge} \mkern-30.5mu}

% (Textstyle = Inline math) \newcommand{\normalcircint}[1]{% \smallerc{#1}\ifx#1\textstyle\mkern-9mu\else\mkern-14.3mu\fi }

\newcommand{\smallerc}[1]{% \vcenter{\hbox{$\ifx#1\textstyle\scriptstyle\else\scriptscriptstyle\fi\wedge$}}% }

% Approach 2: % Source: https://tex.stackexchange.com/questions/237784/how-to-increase-the-arrow-size-on-oint

% Clockwise BIG (Display Style): \newcommand{\scalefactor}{0.7} \newcommand{\rotatefactor}{0} \newcommand{\raiseamt}{0.07em} \newcommand{\leftamt}{-1.287em}

\newcommand{\clockboxintegral}{% \phantom{\int} \hspace{-1mm} \raisebox{\raiseamt}{% \rotatebox{\rotatefactor}{% \scalebox{\scalefactor}{(\lor)}% }% }% \hspace{\leftamt}\sqint}

% Counterclockwise BIG (Display Style): \newcommand{\scalefactorr}{0.7} \newcommand{\rotatefactorr}{0} \newcommand{\raiseamtt}{0.15em} \newcommand{\leftamtt}{-1.287em}

\newcommand{\counterclockboxintegral}{% \phantom{\int} \hspace{-1mm} \raisebox{\raiseamtt}{% \rotatebox{\rotatefactorr}{% \scalebox{\scalefactorr}{(\land)}% }% }% \hspace{\leftamtt}\sqint}

% Clockwise SMALL (Inline Mode): \newcommand{\scalefactorrr}{0.6} \newcommand{\rotatefactorrr}{0} \newcommand{\raiseamttt}{0.07em} \newcommand{\leftamttt}{-0.965em}

\newcommand{\clockboxintegralinline}{% \raisebox{\raiseamttt}{% \rotatebox{\rotatefactorrr}{% \scalebox{\scalefactorrr}{(\lor)}% }% }% \hspace{\leftamttt}\sqint}

\begin{document} [\boxintanticlockwise] [ A+\ointctrclockwise\frac{\dd t}{\log t} \text{ vs. } A+\clockboxintegral\frac{\dd t}{\log t} \text{ vs. } A+\counterclockboxintegral\frac{\dd t}{\log t} ]

[ \ointctrclockwise_{a}^{b} \text{ vs. } \clockboxintegral_{a}^{b} \text{ vs. } \counterclockboxintegral_{a}^{b} ]

[ \frac{1}{2\pi}\ointctrclockwise_{\gamma} \text{ vs. } \frac{1}{2\pi}\clockboxintegral_{\gamma} \text{ vs. } \frac{1}{2\pi}\counterclockboxintegral_{\gamma} ]

[ \frac{1}{2\pi}\ointctrclockwise_{X} \text{ vs. } \frac{1}{2\pi}\clockboxintegral_{X} \text{ vs. } \frac{1}{2\pi}\counterclockboxintegral_{X} ] \noindent \textbf{Inline examples} \[1mm] There is a size difference between the inline integrals (\int \hspace{1mm} \sqint ). \[2mm] But this can more or less fixed : (\int) \scalebox{1.1}{(\sqint)}. \ Example: The integral \(\int f(x)\dd x\) is harder to compute than \scalebox{1.1}{\(\sqint\)}\hspace{0.5mm}\(f(x)\dd x\).' \\[2mm]The integrals (\int f(z)\dd z) and (\int_{\Gamma} f(z)\dd z)...'\[2mm] The integrals \(\sqint f(z)\dd z\) and \(\sqint_{\Gamma} f(z)\dd z\)...' (\textbackslash sqint' is incapable of handlign the subscript (\Gamma) by default)\[2mm] `The integral (\hspace{2mm}\clockboxintegralinline f(z)\dd z) describes a ...'

\end{document}

Output: enter image description here enter image description here

My apologies for not providing a minimal working example; I was not quite able to determine exactly which packages were needed to produce the given output.

I am also not sure how to make the inline version of this symbol play well with subscripts and the surrounding text.

AfterMath
  • 141