Putting a bar above an argument so that they touch - latex

I would like to put a line/bar over an argument, so that the bar just touches the top of the highest point of the argument. I do not want any gap between the bar and argument. Basically, I would like to create a command \justtouching{A} which resembles \r{A}, but with a line instead of a small circle right above the A.
My initial thought was to try and lower the \overline{argument} command so that it just touches the top of the 'argument', but I couldn't quite figure out how to do this.
I don't necessarily need the command to be operable only in the math environment -- manipulating the \overline command was just an idea that I thought would be the easiest to implement.
Any ideas/input would be greatly appreciated. Thanks!

Related

Is it possible to simulate a erase action without having to create an extra shape in KonvaJS?

I am following this guide which contains a brush and eraser functionality. The guide's code sets the "globalCompositeOperation" to "destination-out" and basically ends up creating another line that will cover whatever you have drawn before with the brush.
This would work pretty well in some cases, but if I made my "destination-out" lines not-draggable and the "source-over" lines draggable, then if I drag the "source-over" lines around the canvas these lines would still be intact and it would not look like as if they were erased.
In a better attempt to explain my problem, I provide you this example: If I were to create two parallel lines, line1(x1,y1) and line2(x2,y2), and then I decide to draw a "destination-out" line in the middle of both, is there a way I can keep that "erased" part in the middle of line1 and line2 if I were to move one of the lines away from the "destination-out" line?
I'm sure it is not like this, but is it possible to change certain points inside the line as "destination-out" while the rest of the points are "source-over" If not, how can we simulate this action without having to create a long static extra "destination-out" line?

Arrow symbol with circular headed in latex

I need to use a right arrow symbol in latex such that its left endpoint be a circle (or bullet). I have already tried the following:
\def\cra{\hbox{$\multimapdotinv$}\kern-1.5pt\hbox{$\rightarrow$}}%\rightarrow$}}
but when I have used it in a formula like
$G =G=(\X,\rightarrow,\leftrightarrow,\car,\multimapdotboth)$
the result was
As you can see it does not fit. I have also tried TikZ but it did not work too. Is there anyway that I can make it better?
Thank you in advance.

Maxima for Android (and PC as well): How to reuse the result of a calculation

Let's say I enter this symbolic calculation in Maxima for Android:
integrate(sin(x)*x,x)
The answer is beautifully displayed thanks to MathJack (it is sin(x)-x*cos(x)). Ok, thanks. But now I would like to tap in that answer and have it in the command line, ready to be modified (for instance I may want to multiply it by some number and then use it in another calculation).
What I want is something similar to pressing the "ANS" key in some calculators, where the last result the machine yielded can be used as new input.
In Xcas Pad this is easy and straightforward (just touch on the result, that's all). How to do that in Maxima for Android? (The answer for the PC version of Maxima is also appreciated).
Remark: Copy-paste does not work in Android, because the answers are Latex-formatted or something similar.
You can tap the answer formula displayed with Mathjax in the main area. The maxima expression will be entered in the bottom command area, as you wanted.
Actually, the commands displayed in the main area are also tap-able. You can tap one of them and it is entered in the bottom command area.

How draw a line in a window with wxWidget with erlang?

I try to draw a line in a window with wxWidget in Erlang. I tried:
wx:new(),
Frame = wxFrame:new(wx:null(), ?wxID_ANY, "Hello"),
wxDC:drawLine(50,50),
I get an error:
undefined function wxDC:drawLine/2
I read the documentation here, but I don't understand how to do this:
http://www.erlang.org/doc/man/wxDC.html#drawLine-3
X Windows programming isn't quite that simple, and I'm not quite sure how you are expecting to draw a line with parameters like [50, 50], that's at best a point, and a line needs 2 points, and wxDC:drawLine needs to know where to draw the line too, because you could have many frames.
You can create a frame like this, yes (used -1 instead of the macro because I'm using the shell here):
Wx = wx:new().
Frame = wxFrame:new(wx:null(), -1, "Hello").
Now the important bit, you can't just draw on the frame, you have to register a callback to handle REdrawing. This is because a frame can be covered up at any point by other windows, or because you minimise it, resize it, etc. In fact you don't necessarily need to handle a REdraw for all those cases, but you get the idea.
So, this is not the most efficient, because it performs a redraw regardless of the event, by responding to ANY paint event by drawing a line, but obviously that will do the job:
wxFrame:connect(Frame, paint, [{callback,
fun(_Evt, _Obj) ->
io:format("paint~n"),
DrawContext = wxPaintDC:new(Frame),
wxDC:drawLine(DrawContext, {50, 50}, {150,100}),
wxPaintDC:destroy(DrawContext)
end
}]).
I added the io:format in there so you can see that it is being called when you interact with the window, or some other window interacts with it, because without the io:format call it's a bit invisible in its effect, other than making sure there's always a line in your window.
I also used a draw context. I won't go into it here, I'm afraid it's just one of a load of things you need to learn about X Windows programming, but basically, just be aware for now, you need to have a draw context for your frame, and use that to actually draw with.
One last thing, you need to actually display the frame, if you want to see it, like this:
wxFrame:show(Frame).
Now you should see a window, with a line.
Michael's answer tells you how to do what you want to do, so let me address the confusion about the error
message.
In Erlang, functions that have the same name but different number of arguments are considered separate functions. The number of arguments is called the "arity", and is sometimes indicated as e.g. /2 after the function name.
Your code is calling wxDC:drawLine with two arguments, but you get an error saying that wxDC:drawLine/2 is undefined. In the documentation, you can see that the function you want is wxDC:drawLine/3, which takes three arguments (the first being the draw context, and the second and third being the points between which you want to draw a line).

Is there a way to get LaTeX to place figures in the same page as a reference to that figure?

I am using LaTeX and the figure environment.
I am well familiar with the parameters to that environment: [htbp], and I am also generally familiar with the strategies that LaTeX takes, by default, to decide where to put each figure. For example, by placing figures at the top or bottom of the page.
What I am wondering is whether there is a package, macro, or some commands that I can give so that if I have a single-column document and I mostly have a single in-text reference to a figure, that the figure would be more likely to be placed in the same page of the reference?
For example, imagine that I have a long paragraph which in the middle has a \ref{FIG:X}. When rendered, some of the paragraph appears before the page break, and some appears after the page break. I can also place the figure command somewhere before and after the whole paragraph. Is there a way to get it to actually be placed in the same page as the actual reference?
I don't want to sound too negative, but there are occasions when what you want is almost impossible without a lot of "artificial" tuning of page breaks.
If the callout falls naturally near the bottom of a page, and the figure falls on the following page, moving the figure back one page will probably displace the callout forward.
I would recommend (as far as possible, and depending on the exact size of the figures):
Place the figures with [t] (or [h] if you must)
Place the figures as near as possible to the "right" place (differs for [t] and [h])
Include the figures from separate files with \input, which will make them much easier to move around when you're doing the final tuning
In my experience, this is a big eater-up of non-available time (:-)
In reply to Jon's comment, I think this is an inherently difficult problem, because the LaTeX guys are no slouches. You may like to read Frank Mittelbach's paper.
Yes, include float package into the top of your document and H (capital H) as a figure specifier:
\usepackage{float}
\begin{figure}[H]
.
.
.
\end{figure}
You can always add the "!" into your float-options. This way, latex tries really hard to place the figure where you want it (I mostly use [h!tb]), stretching the normal rules of type-setting.
I have found another solution:
Use the float-package. This way you can place the figures where you want them to be.
I solve this problem by always using the [h] option on floats (such as figures) so that they (mostly) go where I place them. Then when I look at the final draft, I adjust the location of the float by moving it in the LaTeX source. Usually that means moving it around the paragraph where it is referenced. Sometimes I need to add a page break at an appropriate spot.
I've found that the default placement of floats is reasonable in LaTeX, but manual adjustments are almost always needed to get things like this just right. (And sometimes it isn't possible for everything to be perfect when there are lots of floats and footnotes.)
The manual for the memoir class has some good information about how LaTeX places floats and some advice for manipulating the algorithm.
If you want force this behaviour on all of your figures try
...
\usepackage{float}
\floatplacement{figure}{H}
...
Maybe this will help you?
\begin{center}
\includegraphics[scale=0.5]{picture_name}
\end{center}
I think is better to use the graphics command when your figures run away.
I have some useful comments. Because I had similar problem with location of figures.
I used package "wrapfig" that allows to make figures wrapped by text.
Something like
...
\usepackage{wrapfig}
\usepackage{graphicx}
...
\begin{wrapfigure}{r}{53pt}
\includegraphics[width=53pt]{cone.pdf}
\end{wrapfigure}
In options {r} means to put figure from right side. {l} can be use for left side.
\setcounter{topnumber}{2}
\setcounter{bottomnumber}{2}
\setcounter{totalnumber}{4}
\renewcommand{\topfraction}{0.85}
\renewcommand{\bottomfraction}{0.85}
\renewcommand{\textfraction}{0.15}
\renewcommand{\floatpagefraction}{0.7}
http://robjhyndman.com/researchtips/latex-floats/
One way I found that helps with this is to use \include{file_with_tex_figure_commands}
(not input)

Resources