LaTeX: Unnumbered section in header of document - layout

I have a document where I want to place an unnumbered section in my header. I use the fancyhdr package, and for a numbered section, I would had done something like this:
\lhead{\leftmark}
But this don't work with unnumbered sections.
I'm solving math-problems in my document, so I don't want part-sections and numbered sections
Anyone, who knows, how this is done?

Use
\chapter*{Preface\markboth{Preface}{}}
for your unnumbered section. (You should replace chapter with whatever you are actually using.)
You can even try
\newcommand{\mysection}[1]{\section*{{#1}\protect\markboth{#1}{}}}
but be careful -- it may create some problems with TOC or references.

Is there anything wrong with
\section*{}
\subsection*{}
\subsubsection*{}

Related

Link to an arbitrary spot in a multimarkdown file

I'm trying to make the following work:
Here is my markdown text I would like to link to. [link]
Then I write something else.
Then I say [see above](link)
This does not work and I cannot find a way to link to some arbitrary text.
Note: This is not a duplicate of 6695493 as that is a conversation about headers.
This is not a duplicate of any answer that talks about linking to headers.
It looks like the answer is, "No you cannot do this with pure markdown"
You can put some HTML into your file to create a link and then link to that.

Can links to anchors in haddock be labeled?

When linking to a URL, one can provide a label that specifies what the reader will see; for example, <http://www.haskell.org haskell> will have "haskell" for the link text. Unfortunately the documentation does not provide an obvious way to label links to anchors; the link "Data.FooBar#foo" will have "Data.FooBar" for the link text so that it is not obvious to the reader that this link is going to an anchor.
So my question is: is there a trick to label links to anchors in haddock, or is this impossible?
This is now https://github.com/haskell/haddock/issues/262 (submitted by OP).
As I write this, it is open and has not been commented on.
At the moment, when you link to an anchor in haddock using something like "MyModule#anchor", the link on the generated page just says "MyModule". This is very confusing because it looks like the link is taking one to the module page, when really it goes to a specific anchor on that page. It would be great if either the anchor name could be added to the label for the link to make it clear where the links is going, or if there were a way one could manually specify the label of the link --- say, by borrowing the syntax used by URLs to specify the label using a space, such as "MyModule#anchor label goes here".
Its appears they offer no direct way even though their documentation seems to advise on a solution.
REF : http://www.haskell.org/haddock/doc/html/ch03s08.html

Any way in Expression Engine to simulate Wordpress' shortcode functionality?

I'm relatively new to Expression Engine, and as I'm learning it I am seeing some stuff missing that WordPress has had for a while. A big one for me is shortcodes, since I will use these to allow CMS users to place more complex content in place with their other content.
I'm not seeing any real equivalent to this in EE, apart from a forthcoming plugin that's in private beta.
As an initial test I'm attempting to fake shortcodes by using delimited strings (e.g. #foo#) in the content field, then using a regex to pull those out and pass them to a function that can retrieve the content out of EE's database.
This brings me to a second question, which is that in looking at EE's API docs, there doesn't appear to be a simple means of retrieving the channel entries programmatically (thinking of something akin to WP's built-in get_posts function).
So my questions are:
a) Can this be done?
b) If so, is my method of approaching it reasonable? Or is there something stupidly obvious I'm missing in my approach?
To reiterate, my main objective here is to have some means of allowing people managing content to drop a code in place in their content that will be replaced with channel content.
Thanks for any advice or help you can give me.
Here's a simple example of the functionality you're looking for.
1) Start by installing Low Replace.
2) Create two Global Variables called gv_hello and gv_goodbye with the values "Hello" and "Goodbye" respectively.
3) Put this text into the body of an entry:
[say_hello]
Nice to see you.
[say_goodbye]
4) Put this into your template, wrapping the Low Replace tag around your body field.
{exp:low_replace
find="[say_hello]|[say_goodbye]"
replace="{gv_hello}|{gv_goodbye}"
multiple="yes"
}
{body}
{/exp:low_replace}
5) It should output this into your browser:
Hello
Nice to see you.
Goodbye
Obviously, this is a really simple example. You can put full blown HTML into your global variable. For example, we've used that to render a complex, interactive graphic that isn't editable but can be easily dropped into a page by any editor.
Unfortunately, due to parse order issues, EE tags won't work inside Global Variables. If you need EE tags in your short code output, you'll need to use Low Variables addon instead of Global Variables.
Continued from the comment:
Do you have examples of the kind of shortcodes you want to support/include? Because i have doubts if controlling the page-layout from a text-field or wysiwyg-field is the way to go.
If you want editors to be able to adjust layout or show/hide extra parts on the page, giving them access to some extra fields in the channel, is (imo) much more manageable and future-proof. For instance some selectfields, a relationship (or playa) field, or a matrix, to let them choose which parts to include/exclude on a page, or which entry from another channel to pull content from.
As said in the comment: i totally understand if you want to replace some #foo# tags with images or data from another field (see other answers: nsm-transplant, low_replace). But, giving an editor access to shortcodes and picking them out, is like writing a template-engine to generate ee-template code for the ee-template-engine.
Using some custom fields to let editors pick and choose parts to embed is, i think, much more manageable.
That being said, you could make a plugin to parse the shortcodes from a textareas content, and then program a lot, to fetch data from other modules you want to support. For channel entries you could build out of the channel data library by objectiveHTML. https://github.com/objectivehtml/Channel-Data
I hear you, I too miss shortcodes from WP -- though the reason they work so easily there is the ubiquity of the_content(). With the great flexibility of EE comes fewer blanket solutions.
I'd suggest looking at NSM Transplant. It should fit the bill for you.
There is also a plugin called Shortcode, which you can find here at
Devot-ee
A quote from the page:
Shortcode aims to allow for more dynamic use of content by authors and
editors, allowing for injection of reusable bits of content or even
whole pieces of functionality into any field in EE

Is there another way to fix Yesod's nicHtmlField?

I've been rewriting my (fairly simple) website using Yesod as a way to get familiar with the framework. Part of that involves serving some simple static (but formatted) content. To do that I decided to use the nicHtml field that is described in the Yesod book:
http://www.yesodweb.com/book/forms
It allows simple formatting and, as the book says, "thanks to the xss-sanitize package, all user input is validated and ensured to not have XSS attacks."
However, all is not well. Some formatting seems to work when you enter it into the field, but gets wiped out somewhere between entry and submission. In particular, the form uses css embedded in 'style' attributes to do things like center text, and it is these css based formatting elements that seem to get wiped out.
I used print statements to check that it wasn't my code which was somehow messing it up. Since it doesn't seem to be, I assume that xss-sanitize doesn't like any embedded css and removes it. Modifying Yesod.Form.Nic to remove the call to sanitizeBalance appears to fix the problem, so that would seem to be the cause.
Now, I can just leave it like that, since editing these static pages requires being a trusted user anyway (i.e. me at the moment), so I don't care too much about validating out nastiness. But it feels like what it is, a hack, so my question is - is there any other way around this? Or is there another package I don't know about that provides a non-broken HTML editor field for Yesod?
Will you file a bug on the Yesod issue tracker for this? I think we are going to have to allow basic css through the editor no matter which editor we use. In your case of a trusted user, right now you could find the NicEdit field type and create a similar type that won't get filtered at all. Perhaps we should create such a field.
We're actually looking at other possible rich text editors right now for use in the Yesod website, so most likely whatever we use there will end up with a module in yesod-form. Most recently Greg pointed out Aloha editor which on first glance looks pretty cool.

VS2010 modify intellisense popup order via an addin?

Is it possible to modify the order of the intellisense options shown when I hit ctrl-space?
Specifically, I'd like to order them in scope, so that if I have a variable in my function that matches what I've typed so far then it goes to the top of the list. If there's a member in the class, that's next, etc. I'm just kind of sick of having to type enough that I don't match some random global symbol in Windows' crypto libraries or whatever.
Is this kind of this possible? Where do I start? I looked for an obvious option in vs2010, but didn't find anything.
My programming language is native c++.
Here's what I've found so far.
A walkthrough showing how to add items to the intellisense popup: http://msdn.microsoft.com/en-us/library/ee372314.aspx
The walkthrough uses the ICompletionSession interface:
http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.language.intellisense.icompletionsession.aspx
It looks as if you might be able to clear the CompletionSets, and replace them with your own completion sets, but I'm not sure if there's any way to change the order, or if they are always sorted. There is the IIntellisensePresenter interface, but it looks like it's pretty much empty.
Also, from the walkthrough, it looks like you can fill the CompletionSets with a dumb list of strings, so you'd need some other way of interrogating the symbols to determine scope, which may not always be possible.
In short: Probably not possible at the moment.

Resources