LaTeX Error: Command \algorithmic already defined - latex

I wrote my first paper in overleaf and I am about to submit it to arXiv. To do so, i go through 'submit' on the webpage, however, I get 3 errors, which I do not understand well.
> LaTeX Error: Command \algorithmic already defined.
>
> Or name \end... illegal, see p.192 of the manual.
>
> See the LaTeX manual or LaTeX Companion for explanation. Type H
> <return> for immediate help. ...
>
> l.112 }
> % Your command was ignored. Type I <command> <return> to replace it with another command, or <return> to continue without it.
>
> ) Document Style - pseudocode environments for use with the
> `algorithmicx' style )
> (/usr/local/texlive/2022/texmf-dist/tex/latex/mathtools/empheq.sty
> Package: empheq 2017/03/31 v2.15 Emphasizing equations
> (/usr/local/texlive/2022/texmf-dist/tex/latex/mathtools/mhsetup.sty
> Package: mhsetup 2021/03/18 v1.4 programming setup (MH) )
> (/usr/local/texlive/2022/texmf-dist/tex/latex/mathtools/mathtools.sty
> Package: mathtools 2022/02/07 v1.28a mathematical typesetting tools
> (/usr/local/texlive/2022/texmf-dist/tex/latex/tools/calc.sty Package:
> calc 2017/05/25 v4.3 Infix arithmetic (KKT,FJ) \calc#Acount=\count291
> \calc#Bcount=\count292 \calc#Adimen=\dimen173 \calc#Bdimen=\dimen174
> \calc#Askip=\skip58 \calc#Bskip=\skip59 LaTeX Info: Redefining
> \setlength on input line 80. LaTeX Info: Redefining \addtolength on
> input line 81. \calc#Ccount=\count293 \calc#Cskip=\skip60 )
> \g_MT_multlinerow_int=\count294 \l_MT_multwidth_dim=\dimen175
> \origjot=\skip61 \l_MT_shortvdotswithinadjustabove_dim=\dimen176
> \l_MT_shortvdotswithinadjustbelow_dim=\dimen177
> \l_MT_above_intertext_sep=\dimen178
> \l_MT_below_intertext_sep=\dimen179
> \l_MT_above_shortintertext_sep=\dimen180
> \l_MT_below_shortintertext_sep=\dimen181 \xmathstrut#box=\box57
> \xmathstrut#dim=\dimen182 ) \l_EQ_equationtype_int=\count295
> \l_EQ_alignmentmode_int=\count296 \l_EQ_totalwidth_dim=\dimen183
> \l_EQ_displaywidth_dim=\dimen184 \l_EQ_temp_linewidth_dim=\dimen185
> \l_EQ_linewidth_dim=\dimen186 \EmphEqdelimitershortfall=\dimen187
> \EmphEqdelimiterfactor=\count297 \g_EQ_toptag_height_dim=\dimen188
> \g_EQ_bottomtag_depth_dim=\dimen189 \g_EQ_toprow_height_dim=\dimen190
> \g_EQ_bottomrow_depth_dim=\dimen191 \g_EQ_widesttag_dim=\dimen192
> \EQ_mathdisplay_box=\box58 \EQ_tag_box=\box59
> \g_EQ_temprow_int=\count298 )
> (/usr/local/texlive/2022/texmf-dist/tex/latex/natbib/natbib.sty
> Package: natbib 2010/09/13 8.31b (PWD, AO)
Second:
Missing number, treated as zero.
...
Third one:
Missing = inserted for \ifnum.
...

Related

why is this function not compiling in Erlang

I'm a newbie in Erlang so stay with me.
I've got this function in erlang that I'm trying to compile, through the file animal.erl.
module(animal).
help_moi(Animal) ->
Talk = if Animal == cat -> "miaou";
Animal == beef -> "meuuuh";
Animal == dog -> "Wouf";
Animal == tree -> "treee!";
true -> "ezfezfezf,"
end, %blablabla%
{Animal ,"dit", ++ Talk ++ "!" }. %oh là là là%
I'm then compiling it with erl
c(animal).
And these the errors , I'm having
1> c(animal).
animal.erl:1: syntax error before: '.'
animal.erl:9: syntax error before: '++'
animal.erl:9: no module definition
error
I tried to look on google but not much documentations on it.
Any ideas?
The module directive starts with a - character:
-module(animal).
And you have an extra comma between "dit" and ++ Talk.
After fixing those two things, I get a warning, not an error:
animal.erl:2: Warning: function help_moi/1 is unused
You probably want to export the function, so you can call it from outside the module:
-export([help_moi/1]).

Check if environment variable is set in configure script?

I'm trying to test if ANDROID_NDK_ROOT is set in an Autoconf script. The relevant stanza is shown below. According to How can I check an environment variable? on the Autoconf mailing list, I can use:
if test "${var+set}" = set; then
echo "variable \$var is set to: $var"
fi
The variable is not set, but my AC_MSG_ERROR is not being executed.
$ printenv | grep ANDROID_NDK_ROOT
$
Instead, the test is producing the following error:
./configure: line 20616: syntax error near unexpected token `('
./configure: line 20616: ` $as_echo_n "(cached) " >&6'
(There's another reply in the thread but it seems to be just a comment and does not answer the question).
How do I test if an environmental variable is set in Autoconf?
Here is the stanza I am trying to execute in configure.ac:
# if test "$IS_ANDROID_OS" != "0"; then
if true; then
if test "${ANDROID_NDK_ROOT+set}" != set; then
AC_MSG_ERROR([ANDROID_NDK_ROOT is not set. Please set ANDROID_NDK_ROOT])
fi
THIS_FILE="$ANDROID_NDK_ROOT/sources/android/cpufeatures/cpu-features.h"
AC_CHECK_FILE([$THIS_FILE],
[cp "$THIS_FILE" "$ac_srcdir"],
AC_MSG_RESULT([cpu-features.h does not exist in ANDROID_NDK_ROOT, skipping])
)
THIS_FILE="$ANDROID_NDK_ROOT/sources/android/cpufeatures/cpu-features.c"
AC_CHECK_FILE([$THIS_FILE],
[cp "$THIS_FILE" "$ac_srcdir"],
AC_MSG_RESULT([cpu-features.c does not exist in ANDROID_NDK_ROOT, skipping])
)
fi
Here is the chunk of configure from cat -n:
20610
20611 THIS_FILE="$ANDROID_NDK_ROOT/sources/android/cpufeatures/cpu-features.c"
20612 as_ac_File=`$as_echo "ac_cv_file_$THIS_FILE" | $as_tr_sh`
20613 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $THIS_FILE" >&5
20614 $as_echo_n "checking for $THIS_FILE... " >&6; }
20615 if eval \${$as_ac_File+:} false; then :
20616 $as_echo_n "(cached) " >&6
20617 else
20618 test "$cross_compiling" = yes &&
20619 as_fn_error $? "cannot check for file existence when cross compiling""$LINENO" 5
20620 if test -r "$THIS_FILE"; then
20621 eval "$as_ac_File=yes"
20622 else
20623 eval "$as_ac_File=no"
20624 fi
I came across this old question and figured I'd share a solution I ended up using when I needed to check multiple variables were set (in this sanitized example, VAR1 thru VAR4):
m4_foreach_w([my_var],[VAR1 VAR2 VAR3 VAR4],[
AS_VAR_IF(myvar, [], AC_MSG_ERROR([Missing required variable: myvar!]))
AC_SUBST(myvar)dnl Export variable to Makefile as well
AC_ARG_VAR(myvar, [])dnl if this variable changes, re-run configuration
])
There's nothing wrong with your shell syntax for testing whether a variable is set, and it works fine with Autoconf.
The problem appears to arise from failing to quote the third arguments to the AC_CHECK_FILE() macros. You should always quote (with square brackets) each argument to each macro, especially when that argument is or contains a macro call itself. I can reproduce a syntax error in configure by wrapping the example code you provided between an AC_INIT and an AC_OUTPUT, but it goes away with proper quoting. Specifically, here:
THIS_FILE="$ANDROID_NDK_ROOT/sources/android/cpufeatures/cpu-features.h"
AC_CHECK_FILE([$THIS_FILE],
[cp "$THIS_FILE" "$ac_srcdir"],
[AC_MSG_RESULT([cpu-features.h does not exist in ANDROID_NDK_ROOT, skipping])]
)
THIS_FILE="$ANDROID_NDK_ROOT/sources/android/cpufeatures/cpu-features.c"
AC_CHECK_FILE([$THIS_FILE],
[cp "$THIS_FILE" "$ac_srcdir"],
[AC_MSG_RESULT([cpu-features.c does not exist in ANDROID_NDK_ROOT, skipping])]
)
Failing to quote the argument results in it being expanded too many times, and the resulting output indeed is not syntactically valid shell code.

F# Charting on MacOS (Xamarin)

Hi I'm running on Xamarin 6.1.5 on MacOS
I've installed FSharp.Charting 0.90.14
its the first time I'm trying to use it
whether i try to compile or i try in F# interactive, i get this kind of error
(Chart.Line [ for x in 1.0 .. 100.0 -> (x, x ** 2.0) ]).ShowChart();;
System.ArgumentNullException: Value cannot be null.  Parameter name:
key   at System.ThrowHelper.ThrowArgumentNullException
(...)
EDIT1
I was very stupid indeed and did not install the Gtk version
EDIT2
the above one-liner code in F# interactive "works". It takes some unusual time to execute, but i see the window with the chart. It is not possible to hover on the chart and see coordinates, but maybe its not a default setting ?
also, i don't understand how to CLOSE the window where the chart appears.
Is everything alright ?
Aren't you trying to use FSharp.Charting package on Mac instead of FSharp.Charting.Gtk, as documentation says you to do?
See https://fslab.org/FSharp.Charting/ReferencingTheLibrary.html
Edit: answering to the edit of the original question: no, there should be no warnings. That's how it works for me:
$ fsharpi
F# Interactive for F# 4.1
Freely distributed under the Apache 2.0 Open Source License
For help type #help;;
> #load "packages/FSharp.Charting.Gtk.0.90.14/FSharp.Charting.Gtk.fsx" ;;
[Loading /Users/avysk/Projects/_Sandbox/testfsharpcharting/packages/FSharp.Charting.Gtk.0.90.14/FSharp.Charting.Gtk.fsx]
namespace FSI_0002.FSharp.Charting
val verifyMac : unit -> bool
val isMac : bool
module FsiAutoShow = begin
end
> open FSharp.Charting ;;
> (Chart.Line [ for x in 1.0 .. 100.0 -> (x, x ** 2.0) ]).ShowChart();;
Binding session to '/Users/avysk/Projects/_Sandbox/testfsharpcharting/packages/FSharp.Charting.Gtk.0.90.14/lib/net40/OxyPlot.dll'...
Binding session to '/Users/avysk/Projects/_Sandbox/testfsharpcharting/packages/FSharp.Charting.Gtk.0.90.14/lib/net40/OxyPlot.GtkSharp.dll'...
val it : unit = ()
(The window appears immediately.)

Orbeon 4.3 and localistion

I am trying to create an additional language entry for orbeon 4.3pe following this guide:
http://wiki.orbeon.com/forms/doc/contributor-guide/localizing-orbeon-forms
I did this couple of times for older versions of Orbeon (4.2 and 4.0) and it always worked that way.
The moment I remove the app/fr/i18n directory the application starts to work again.
When I start the application I get this error:
Toggle org.orbeon.saxon.trans.XPathException
Exception Class org.orbeon.saxon.trans.XPathException
Message An empty sequence is not allowed as the first argument of xxf:format-message()
The error seems to come from oxf:/apps/fr/components/components.xsl
The additional information:
element →
evaluating XPath expression
expression → xxf:format-message( $fr-resources/errors/form-title, ( xxf:instance('fr-error-summary-instance')/visible-counts/(if (count((#error, #warning, #info)[. gt 0]) gt 1) then 3 else if (#error gt 0) then 0 else if (#warning gt 0) then 1 else if (#info gt 0) then 2 else 4), xxf:instance('fr-error-summary-instance')/visible-counts/xs:integer(#alert), $title ) )
The most likely scenario is that you are providing a resources.xml file which does not match the one that ships with that specific Orbeon Forms version. Try this:
extract resources.xml from orbeon-form-runner-jar, or check this version on github for 4.3
in that file, compare the English section with your language section, and see if resources entries are not matching

Undefined Reference To yywrap

I have a simple "language" that I'm using Flex(Lexical Analyzer), it's like this:
/* Just like UNIX wc */
%{
int chars = 0;
int words = 0;
int lines = 0;
%}
%%
[a-zA-Z]+ { words++; chars += strlen(yytext); }
\n { chars++; lines++; }
. { chars++; }
%%
int main()
{
yylex();
printf("%8d%8d%8d\n", lines, words, chars);
}
The I run a flex count.l, all goes ok without errors or warnings, then when I try to do a cc lex.yy.c I got this errors:
ubuntu#eeepc:~/Desktop$ cc lex.yy.c
/tmp/ccwwkhvq.o: In function yylex':
lex.yy.c:(.text+0x402): undefined reference toyywrap'
/tmp/ccwwkhvq.o: In function input':
lex.yy.c:(.text+0xe25): undefined reference toyywrap'
collect2: ld returned 1 exit status
What is wrong?
The scanner calls this function on end of file, so you can point it to another file and continue scanning its contents. If you don't need this, use
%option noyywrap
in the scanner specification.
Although disabling yywrap is certainly the best option, it may also be possible to link with -lfl to use the default yywrap() function in the library fl (i.e. libfl.a) provided by flex. Posix requires that library to be available with the linker flag -ll and the default OS X install only provides that name.
I prefer to define my own yywrap(). I'm compiling with C++, but the point should be obvious. If someone calls the compiler with multiple source files, I store them in a list or array, and then yywrap() is called at the end of each file to give you a chance to continue with a new file.
int yywrap() {
// open next reference or source file and start scanning
if((yyin = compiler->getNextFile()) != NULL) {
line = 0; // reset line counter for next source file
return 0;
}
return 1;
}
int yywrap(){return(1);}
use this code at the end of the program..Simple
flex doesn't always install with its development libraries (which is odd, as it is a development tool). Install the libraries, and life is better.
On Redhat base systems:
yum -y install flex-devel
./configure && make
On Debian based systems
sudo apt-get install libfl-dev
As a note for followers, flex 2.6.3 has a bug where libfl.a "typically would" define yywrap but then doesn't in certain instances, so check if that's your version of flex, might be related to your problem:
https://github.com/westes/flex/issues/154

Resources