letter

Automatically capitalize first letter of first word in a new sentence in LaTeX

一个人想着一个人 提交于 2020-01-01 02:35:09
问题 I know one of LaTeX's bragging points is that it doesn't have this Microsoftish behavior. Nevertheless, it's sometimes useful. LaTeX already adds an extra space after you type a (non-backslashed) period, so it should be possible to make it automatically capitalize the following letter as well. Is there an obvious way to write a macro that does this, or is there a LaTeX package that does it already? 回答1: The following code solves the problem. \let\period. \catcode`\.\active \def

Regex capitalize first letter every word, also after a special character like a dash

倾然丶 夕夏残阳落幕 提交于 2019-12-28 02:08:48
问题 I use this #(\s|^)([a-z0-9-_]+)#i for capitalize every first letter every word, i want it also to capitalize the letter if it's after a special mark like a dash(-) Now it shows: This Is A Test For-stackoverflow And i want this: This Is A Test For-Stackoverflow Any suggestions/samples for me? I'am not a pro, so try to keep it simple for me to understand. 回答1: A simple solution is to use word boundaries: #\b[a-z0-9-_]+#i Alternatively, you can match for just a few characters: #([\s\-_]|^)([a-z0

REGEXP returning false on special characters

这一生的挚爱 提交于 2019-12-24 13:48:21
问题 I'm not too good in regexp but hoping someone could explain better to me, I found this in the code that I debug. I wonder why I always got false on this scenario. I know \p{L} matches a single code point in the category "letter". 0-9 is numeric. $regExp = /^\s* (?P([0-2]?[1-9]|[12]0|3[01]))\s+ (?P\p{L}+?)\s+ (?P[12]\d{3})\s*$/i; $value = '12 Février 2015' ; $matches = array(); $match = preg_match($regExp, $value, $matches); Additional information, I have come up with this: $match = preg_match

Immediately show autocomplete on Android

社会主义新天地 提交于 2019-12-21 07:12:08
问题 The Android autocomplete only starts after two letters. How can I make it so the list appears when the field is just selected? 回答1: Extend the AutoCompleteTextView, overriding the enoughToFilter() methods and the threshold methods so that it doesn't replace the 0 threshold with a 1 threshold: public class MyAutoCompleteTextView extends AutoCompleteTextView { private int myThreshold; public MyAutoCompleteTextView(Context context) { super(context); } public MyAutoCompleteTextView(Context

How to print frequencies in descending order?

风格不统一 提交于 2019-12-20 04:03:46
问题 I've had a look at other similar questions already but haven't been able to apply the answers to my program. At the moment the frequencies are printed in ascending order, what do I change to make it print it in descending order? from sys import argv frequencies = {} for ch in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ': frequencies[ch] = 0 for filename in argv[1:]: try: f = open(filename) except IOError: print 'skipping unopenable', filename continue text = f.read() f.close() for ch in text: if ch.isalpha()

Randomly choosing from a list with weighted probabilities

别等时光非礼了梦想. 提交于 2019-12-17 10:54:32
问题 I have an array of N elements (representing the N letters of a given alphabet), and each cell of the array holds an integer value, that integer value meaning the number of occurrences in a given text of that letter. Now I want to randomly choose a letter from all of the letters in the alphabet, based on his number of appearances with the given constraints: If the letter has a positive (nonzero) value, then it can be always chosen by the algorithm (with a bigger or smaller probability, of

How to compute letter frequency similarity?

喜你入骨 提交于 2019-12-14 00:21:52
问题 Given this data (relative letter frequency from both languages): spanish => 'e' => 13.72, 'a' => 11.72, 'o' => 8.44, 's' => 7.20, 'n' => 6.83, english => 'e' => 12.60, 't' => 9.37, 'a' => 8.34, 'o' => 7.70, 'n' => 6.80, And then computing the letter frequency for the string "this is a test" gives me: "t"=>21.43, "s"=>14.29, "i"=>7.14, "r"=>7.14, "y"=>7.14, "'"=>7.14, "h"=>7.14, "e"=>7.14, "l"=>7.14 So, what would be a good approach for matching the given string letter frequency with a

How to extract first letters from different words in a string in c# [closed]

混江龙づ霸主 提交于 2019-12-13 09:55:57
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . I want to extract first letter of each word in a string. I have done a lot of googling and still without any aid. For example, string text = "I Hate Programming"; The desired answer should be like: IHP I know you

Reading characters and checking if they're a number

回眸只為那壹抹淺笑 提交于 2019-12-11 18:48:22
问题 I am trying to get a method that checks if character after the symbol & is a number or a letter; if a number, it is translated into binary; and if it is a letter, it is set to 16 and is incremented by 1 if a different word is being used. The trouble is, this doesn't work for me, for some reason. Any suggestions? try { ReadFile files = new ReadFile(file.getPath()); String[] anyLines = files.OpenFile(); int i; for (i=0; i<anyLines.length; i++) { String input = anyLines[i]; String[] lines =

PHP Vertical Alphabet Using FOR Cycle

泄露秘密 提交于 2019-12-11 03:38:32
问题 I'm trying to do a script in PHP which will generate a table with vertical alphabet in it. It will simply echo letters from A to Z and when it comes to Z, it will reset and begin from A again. I have a problem with this because I only can repeat this twice, then all cells have some unwanted signs in them. I'm echo-ing the letter using their ASCII html codes, where the A sign is &#65 and the Z sign is &#90. Here is the code I have until now, thanks for help. <!DOCTYPE html> <html> <head> <meta