Skip to main content

Questions tagged [calc]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
27 views

How to make end of line draw match the node at the end of another line

I would like to represent a camera placed on the ceiling with a rectangular node and lines representing the focus of the camera. The code is as follows: \documentclass[border=2mm]{standalone} \...
pablo's user avatar
  • 551
0 votes
1 answer
31 views

Cross out if no table entry in a longtable environment

I changed a command from "Heiko Oberdiek" (Strike out a table cell) a little bit and it works fine in the standard tabular environment. \newcounter{NoTableEntry} \renewcommand*{\...
Viggo's user avatar
  • 65
0 votes
1 answer
17 views

Georgia Tech thesis template issues with optidef (calc) and subsection

The issues & solutions I encountered 2 challenges with the Georgia Tech thesis template: When using the optidef package (and probably other packages too), there are conflicts with the calc ...
gchen's user avatar
  • 13
3 votes
3 answers
290 views

extract x/y value in cm from coordinate

I would like to extract the x/y coordinate with cm as unit. below example extract it as pt. \documentclass[]{standalone} \usepackage{tikz} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \...
lucky1928's user avatar
  • 4,285
4 votes
1 answer
195 views

Negative `\widthof` doesn't work?

I am basically reasking the same question as here, which hasn't had any definitive answer even yet. I restate the problem. The MWE \documentclass{book} \usepackage{calc} \begin{document} \hspace{...
Atom's user avatar
  • 665
1 vote
2 answers
78 views

Weird behavior of \setlength

I wish to use the code below in order to get the maximum length of a list of words. \documentclass[border=5mm]{standalone} \usepackage{tikz} \usepackage{calc} \begin{document} \begin{tikzpicture} \...
lucky1928's user avatar
  • 4,285
1 vote
1 answer
51 views

fontspec's \addfontfeatures messes with calc's \widthof

In addition to Werner's answer, I would also like my list labels to use tabular numbers. I would have thought that the first approach below would work, but the list labels are slightly in the left ...
Fredrik P's user avatar
  • 1,418
2 votes
3 answers
290 views

LaTeX calculator with variables and number substitution

Is there a calculator with variables and number substitution with LaTeX syntax? Here is an example: First I set the variables: m_\text{груза} = 5 h = 2 g = 9,81 Next, I write the equation to be ...
Andrey Gusev's user avatar
1 vote
2 answers
53 views

Error with a command whose purpose is to allow a value to adapt over the course of a document

I am trying to write a command that will do the following, in order: Measure the width of an input word. Compare this value to an existing value. If the input word's width is greater, then take on ...
Noah J's user avatar
  • 515
1 vote
1 answer
40 views

LaTeX reserving space for undrawn coordinates

I'm trying to write a function to ease the drawing of figures. I called this function \drawcurve as is shown below. It's purpose is to create a curve between 2 lines indicated by coordinates in it's ...
Siebe Arnout's user avatar
0 votes
1 answer
142 views

Page Background for Certain Pages Only

Consider the code: \documentclass{article} \usepackage{background} \usetikzlibrary{calc} \usepackage{lipsum} \backgroundsetup{ color=black, scale=1, opacity=1, angle=0, contents={\tikz\draw[line ...
DDS's user avatar
  • 9,768
3 votes
2 answers
150 views

round number to nearest tenth using calc

I'm trying to use the below code to get 0,1,2,...,5 but I'm getting 0.59999,0.79999,0.9999. How is it possible to fix it \foreach \i [] in {0,0.2,...,1}{ \draw (0,{5*\i}) --++(-0.2,0) node[left]{$\...
Diana's user avatar
  • 1,289
1 vote
1 answer
124 views

Calc \widthof error

I'm trying to use the \widthof command (calc package) inside the \ifdimcomp command (etoolbox package), but I keep getting an error "Missing number, treated as zero" which confuses me. I'm ...
User23456234's user avatar
  • 1,888
2 votes
0 answers
71 views

How to Produce a Rectangular Radial Glow

Consider the code \documentclass[a5paper,12pt,onecolumn,openany,final]{book} \usepackage[hmargin=0.7in,vmargin=0.75in]{geometry} \usepackage{tikz} \usepackage{calc} \usetikzlibrary{fadings} \...
DDS's user avatar
  • 9,768
3 votes
1 answer
60 views

Tikz: use coordinates returned from macro

How to use a coordinate returned from a macro, for instance, with shift? See the following MWE. I tried changing where the involved delimiters are defined (inside or outside the macro), but I always ...
Kevlar's user avatar
  • 154
0 votes
1 answer
57 views

Spacing by a calculated value with a counter

I want to create an oblique table of content, my strategy has been so far to do the following: \newcounter{agendacount} \setcounter{agendacount}{0} \setbeamertemplate{section in toc}{% \hspace{-0....
BlueMagma's user avatar
  • 101
1 vote
1 answer
81 views

Measure the horizontal distance between two nodes and apply to relative placement between two other nodes

I would like to measure the horizontal distance between two nodes A and B, and then place another node Y the same horizontal distance from X, but aligned vertically with v0. What's the syntax for that?...
dedded's user avatar
  • 2,308
-1 votes
4 answers
390 views

How to \read inside a command and return the result?

As a followup of How to use file content as a numeric value for a length?, I'm trying to do this (I really need to read the data.txt file inside this new command and use the value later, when the ...
yegor256's user avatar
  • 12.2k
0 votes
1 answer
45 views

How to use decimal computations inside parentheses to compute the height of an image?

I have the following LaTeX file which does not compile: \documentclass{report} \usepackage{calc} \usepackage{graphicx} \newcommand\AFiveHeight{210mm} \newcommand\BodyToLayoutRatio{0.7} \newcommand\...
Liisi's user avatar
  • 137
3 votes
2 answers
155 views

Coloring slices of a hypermatrix

I was able to use tikz to make a 2 by 2 by 2 hypermatrix using the following latex code: \documentclass{article} \usepackage{tikz-cd} \usetikzlibrary{calc} \usetikzlibrary{arrows} \begin{...
fdzsfhaS's user avatar
  • 259
3 votes
8 answers
959 views

How do I print an increasing value with iteration in LaTeX?

For example, I want to print all values x + 1 with n repetition In Python it would be: def arithmetic_add_1_(n,x): for k in range(n): print(x) x = x+1 print(x) with n -> repetitions ...
Debush's user avatar
  • 49
2 votes
1 answer
259 views

How to draw \hrule based on text width?

I have a \divider command where it draws a thick hrule and a thin hrule to achieve the style I want: \newcommand{\divider}[1]{% \vskip-2pt % {% \color{black}% \hrule% }% ...
Yuchen Zhang's user avatar
4 votes
2 answers
659 views

How can I calculate width using an expression (like \textwidth - \widthof{dummy text})?

Take a table for example. We have one column with some arbitrary length short text, and the other column has large descriptions. To save the reader time: \documentclass{article} \usepackage{lipsum} \...
Book Of Flames's user avatar
2 votes
1 answer
92 views

Negating coordinates

This actually seems like an easy thing to do but I have not found any solution: I would like to negate/invert predefined coordinates as simple and with few characters as possible. I.e. using (A) as (0,...
Pratched's user avatar
  • 419
0 votes
1 answer
417 views

Multiply constant to \widthof

I'm trying to compress some text using \resizebox. When I use an absolute value, it works fine \resizebox{2em}{\height}{AAAAA} when I use a partial of e.g. \textwidth it also works fine \resizebox{0....
cagcoach's user avatar
  • 160
1 vote
2 answers
58 views

How can you align text in a tabular in the top left corner with listing

I am creating a pseudo latex interface of a console GUI. I do not want to use screenshots of the GUI because I need the text to be able to go to the next page. What I have right now is this: \...
Darius Takacs's user avatar
4 votes
1 answer
385 views

An environment of tcolorbox to draw vertical lines configurable in numbers and in color?

I was inspired by the code of Ignasi in the following link: Mark (highlight) a paragraph (\item{…}) with a squiggly line across several pages I modified it to do the following command: which draws #1 ...
StephaneC's user avatar
1 vote
0 answers
100 views

setting column width in tabular* with the calc package

I have a problem setting the column with using the calc package, which should be quite straightforward, but I cannot figure it out. \documentclass{article} \usepackage{array} \usepackage{calc} \...
jopeto's user avatar
  • 165
0 votes
1 answer
512 views

Package calc error`\let ' invalid at this point, probably wrong unit of measure

I'll attach a MWE which replicates the problem \documentclass[a4paper,11pt,oneside,notitlepage,reqno]{book} \usepackage{minted} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage[...
Valerio Tirelli's user avatar
3 votes
2 answers
271 views

LaTeX throws error on \heightof

I'm trying use \heightof in my document but XeLaTeX throws an error. Both minimal code end errors are below. Ubuntu 20.04 with latest updates \documentclass[14pt,a4paper]{extarticle} \usepackage{calc} ...
Alexander's user avatar
2 votes
3 answers
173 views

Is there more compact way of simple point calculations?

I have this code: \documentclass{article} \usepackage{tikz} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \coordinate (A) at (0,0); \coordinate (B) at (2,2); \draw[...
Allok's user avatar
  • 405
2 votes
2 answers
57 views

Replacing length registers in expressions

I have some understanding on how to use length registers for calculations. However, I always end up requiring way too many length registers for tasks which could probably be solved better by ...
Nobody-Knows-I-am-a-Dog's user avatar
4 votes
2 answers
2k views

How to use "calc" library to sum coordinates?

Why does the following code draw an inclined line? I thought the sum ($(1,6) + (2,0)$) would return a point (3,6). \documentclass[dvipsnames]{article} \usepackage[utf8]{inputenc} \usepackage{xcolor} \...
Allok's user avatar
  • 405
1 vote
1 answer
125 views

Specify the precision in mathparse calculus

I have defined the function f(x) = (sqrt(x)-1)/(x-1) and I need to calculate several values for f(x). I have developed the following code, but, I cannot to specify the precision for f(x), for example, ...
Angelo Aliano Filho's user avatar
1 vote
1 answer
245 views

patching \setcounter and \addotocounter not working well with calc

for some very specific needs of reledac, I need to get the value of the page counter each time it is changed, either via settocounter, either with addotcounter. So I did something like this (it is a ...
Maïeul's user avatar
  • 11k
2 votes
0 answers
131 views

Does the \setlength have any feature not found in geometry package ؟ [closed]

Do we need to use \setlength if we use the geometry package? Does the \setlength have any feature not found in geometry package?
Mamoun Mohammed's user avatar
4 votes
2 answers
302 views

Why can't I multiply size by integer in calc?

This is what I'm doing: \documentclass{article} \usepackage{calc} \newlength{\foo} \newcommand{\zzz}{5} \setlength{\foo}{\zzz * 2in} \usepackage[paperwidth=\foo,paperheight=\foo]{geometry} \begin{...
yegor256's user avatar
  • 12.2k
1 vote
1 answer
83 views

In LaTeX, can I access the contents of a hyperref TextField and display them below, marked up in math mode?

It's fairly easy to set up a fillable field. How can I access the contents of that field and display them, marked up using math mode? \documentclass[a4paper,11pt]{article} \usepackage{hyperref} \...
Ryan's user avatar
  • 11
0 votes
0 answers
551 views

Calc Style is Missing from TexLive

I am quite new to the tex space. I recently installed Latex in conjunction to texlive (easy editor). I need to write a paper in astronomy and astrophysics but when I use the required template it says ...
Milan's user avatar
  • 101
0 votes
1 answer
455 views

Rules of column width in tabular

I would like to put rules in a tabular to "strike out" a number of consecutive cells within one row. I want these rules to automatically adjust to column width. For example, the width of ...
Widdershins's user avatar
2 votes
1 answer
53 views

gcd in spreadtab error

why wont my code work? I get up to 22 errow massages \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{dcolumn} \usepackage{spreadtab} \usepackage{siunitx} \usepackage{mathtools} \...
Derr Herr's user avatar
  • 359
2 votes
1 answer
62 views

a bug with calc and ehhline together

Days before, I was dealing with the problem of drawing horizontal lines between colored multirow cell with \hhline. I tried two method and took the second at last. But I found there is a bug in the ...
ZhiyuanLck's user avatar
  • 4,526
1 vote
1 answer
144 views

ssconvert convert to table, ratio calculate error : Missing number, treated as zero

ssconvert convert to table,but ratio calculate error. I searched around and found no solution. Is there a problem with ssconvert's table conversion? \documentclass{article} \def\inputGnumericTable{} ...
user140272's user avatar
6 votes
3 answers
680 views

Change cone width

I am trying to draw some simple cones as depicted below Using my own code this is what I have so far How can I make the base of the green cone narrower so it fits within the gray one Why are only ...
N3buchadnezzar's user avatar
0 votes
1 answer
280 views

LaTeX Math operations

I am trying to add two values and then multiply them by a number but in order to do it in that order I have to use parentheses. The problem is that when I add parentheses I get a compilation error. ...
Jacob Hacker's user avatar
3 votes
1 answer
385 views

Adjusting minipage's width to avoid line breaks

For foo and baz, widthof return sensible/nonsensible values. When the width of the minipage wrapped around foo and baz is set to these numbers, neither has the desired width, that is, the width of the ...
Erwann's user avatar
  • 2,130
2 votes
1 answer
59 views

"Hidden text" inflates `widthof`

French letters call for a heading stating place and date, which I put in \letterlieudate, which I put in a minipage. Requirement: that the minipage's width be just big enough so that \letterlieudate ...
Erwann's user avatar
  • 2,130
2 votes
1 answer
134 views

Can tikz projections be computed in three dimensions?

According to the pgf manual, the syntax <coordinate>!<projection coordinate!<angle>:<second coordinate> can be used to project <projection coordinate> orthogonally onto ...
Brian Fitzpatrick's user avatar
2 votes
1 answer
289 views

Tikz: Calculations with coordinates

Inspired by the question How to draw a line passing through a point and parallel to another? I'm trying to do some arithmetic with coordinates. The code below does not work, but I hope that with a ...
PeptideChain's user avatar
  • 1,335
5 votes
1 answer
244 views

Climate flow chart

I am trying to draw the following "flowchart" After some fiddling I was able to come up with the following solution What I am struggling with mainly boils down to two things How can I align the ...
N3buchadnezzar's user avatar