Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by h1439878.stratoserver.net (8.14.4/8.14.4/Debian-2ubuntu2.1) with ESMTP id t73CMSgY006110 for ; Mon, 3 Aug 2015 14:22:29 +0200 Received: from relay.uni-heidelberg.de ([129.206.100.212]) by mx-ha.gmx.net (mxgmx008) with ESMTPS (Nemesis) id 0Labh1-1YaHD721qZ-00mHKY for ; Mon, 03 Aug 2015 14:22:22 +0200 Received: from listserv.uni-heidelberg.de (listserv.uni-heidelberg.de [129.206.100.94]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id t73CJ3uW020546 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 3 Aug 2015 14:19:03 +0200 Received: from listserv.uni-heidelberg.de (listserv.uni-heidelberg.de [127.0.0.1]) by listserv.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id t73400fC010249; Mon, 3 Aug 2015 14:19:03 +0200 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 12493682 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Mon, 3 Aug 2015 14:19:03 +0200 Received: from relay.uni-heidelberg.de (relay.uni-heidelberg.de [129.206.100.212]) by listserv.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id t73CJ36T018058 for ; Mon, 3 Aug 2015 14:19:03 +0200 Received: from sipsolutions.net (s3.sipsolutions.net [5.9.151.49]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id t73CIvip020505 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) for ; Mon, 3 Aug 2015 14:19:00 +0200 Received: by sipsolutions.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_RC3) (envelope-from ) id 1ZMEhl-0005U2-OC for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Mon, 03 Aug 2015 14:18:57 +0200 References: <1438598845.15593.28.camel@sipsolutions.net> <55BF4AAE.5010002@nag.co.uk> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-AmWyFGi4PJDMxGp5/tmT" X-Mailer: Evolution 3.16.3-1 Mime-Version: 1.0 Message-ID: <1438604337.15593.45.camel@sipsolutions.net> Date: Mon, 3 Aug 2015 14:18:57 +0200 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Benjamin Berg Subject: Re: Difference between \addtocounter and \int_gincr inside tabularx To: LATEX-L@LISTSERV.UNI-HEIDELBERG.DE In-Reply-To: <55BF4AAE.5010002@nag.co.uk> Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: Envelope-To: X-GMX-Antispam: 0 (Mail was not recognized as spam); Detail=V3; X-GMX-Antivirus: 0 (no virus found) X-UI-Filterresults: notjunk:1;V01:K0:8YsJL7tZdXU=:ikrXbNGgM/Wn2tmMQojoVC8z5W zGiMHyoSjxZYNyAm9EgxN06TDmyJPe95AO/rMwfu2vkPaYfQZwKNUXzRjwZkNqjnnOYhb4CBa ZWVrRG3HJUBmg9I9wC0smL2Tnh9DlNwh4eIetvtR0Z2dbW7LlbkwhIWFdpbbhxS2XgPe7DpFO Pvt+rD7zVQDgSGAIpqvu8YSzShkVjEQ4olDYE/+izi4hL1bAbbegu42ON6n6ak0CCU5LlMV5g ++Llcm2eK/3dnbtPXvD7pzMBqcxRvG8AZxiASy79qz8mprPUF2wimWxhafChpGDmBFG4rTVFi 7lEfiMXii8Ql2eOgaHVjNGTNhnH9yHpN1zeWRoBEtqVFWIqyyDqDcHpkLhB9MSzL/U2L913EN iHQBQyZVvnH0IIfFg8ZRb+ChTPMlJnytSd/P+xmOHi62fEKcEkitpScGD+H0zMriYlDQSn9PK MZ+I0LNNCxklZTelftmpL07ID9SOwzhKhnP7HPkb6KaVQFYNpUruAH405EmQo99ehcTOoaEXK +nTKcVH49hTvqrFOaONFW8z85V+TIamGrdgdxICgx/y/JrYHHFKh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cMfcA8pYyxGtAbto5DObYwytc8cav0ioXwvZBFV/gIidsE2bpEq93hqG 0qS4G8XLR7gQrqjKwdHdv9ee8bVWIEcYV1tqskUuKtvKVAm+VvYSbPaDJvRtHN2QrrWfo8O4s aIE1pHTw4Ufod+rVAvbApkaiTJgBRT5e9I0qcaiEzAaa6Kvg4L3rFNzSPlqEtmJiMuZSLptZX 3hv3ytOzJB2UVf1ge80j2givblwZFY8G1VVasXHBfwkI7BITIM4DUvHTo4uZMY2QIMJaPKHR0 3R74PEpJuNIdIWiSlrnNHwiQuwQB675kOztCNbEmQvdFX2RGpBFTUgRijAkV7KTWikaDkO84Y Wnb0LjM5M83Rie3kUzXGZO8/P79gtGHrY2UtnSnMbdjvpftwHn0y+icl8KUsBCX5GUKNrfphs mnuKVJCIk31iex6fotPYSMsGEo6s0tMQw8fuZqBthVaFvJZV9vUg X-Scanned-By: MIMEDefang 2.71 on 85.214.41.38 Status: R X-Status: X-Keywords: X-UID: 7812 --=-AmWyFGi4PJDMxGp5/tmT Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, On Mo, 2015-08-03 at 12:04 +0100, David Carlisle wrote: > On 03/08/2015 11:47, Benjamin Berg wrote: > > I am having trouble to understand what the difference between > > \addtocounter and \int_gincr:N is. When used inside a tabularx > > environment, the \int_* functions do not work correctly, but the normal > > LaTeX counters do. > >=20 > > Maybe the idea of even using counters in a tabularx environment like > > this is totally wrong[1], but it feels to me like the two commands > > should behave in the same way. So either I am not grasping some > > concepts (feel free to just point me to an explanation) or there might > > even be a small bug. > >=20 > > So, the attached document will print two tables. For each cell the > > output of "\int_use:N \g_test_int,~\thetestcount" is displayed. The > > counter is behaving as I expect while the \g_test_int has different > > values inside tabularx. > >=20 > >=20 > > tabularx: > > 3, 1 4, 2 1, 3 2, 4 > > 3, 1 4, 2 > >=20 > > and tabular: > > 1, 1 2, 2 3, 3 4, 4 > > 1, 1 2, 2 > >=20 > > It looks like this has to do with the fact that in the second row there > > are empty cells. But it still baffles me, that the latex counters > > behave correctly, while latex 3 integers do not. > >=20 > > Regards, > > Benjamin > >=20 > > [1] It is very likely that I will drop the tabularx anyways. > >=20 >=20 >=20 > tabularx typesets its body multiple times with trial settings to find > the right widths. So in general any command that is doing anything with > global side effects like incrementing a counter will increment multiple > times. >=20 > You would see the same with plain tex syntax \newcounter\foo.... if you u= se > \global\advance\foo 1 > inside tabularx. >=20 > latex counters have a reset mechanism (designed for use with restoring > counters after \include, mostly) tabularx uses this to restore all > counters at the start of every trial setting. >=20 > \hfuzz is \maxdimen in trials so you can avoid incremengting counters > during trials with >=20 > \ifdim\hfuzz<\maxdimen > ... >=20 > but sometimes your code needs to increment and then restore, which is a > bit more work. Ah, now that makes a lot of sense, thanks for explaining! :) I guess I was under the impression that tabularx required multiple latex calls, instead of doing multiple trail runs during one latex run. And I had no idea there was code to reset the global scope to some extend. Best solution for me will be to replace the tabularx use with a normal tabular or even a tabbing environment. Benjamin --=-AmWyFGi4PJDMxGp5/tmT Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEABECAAYFAlW/XDEACgkQJddvdAxOva4LCACfQvtu3LXFhBwn8mc9A/ofwYeK w/IAn2gQiqHf6AJGltIkPxf8CEzdr71X =HpdV -----END PGP SIGNATURE----- --=-AmWyFGi4PJDMxGp5/tmT--